Merge pull request #24372 from taosdata/feat/TD-28140-3.0

feat: websocket support bi with appending &conn_mode=1 string to dsn
This commit is contained in:
Alex Duan 2024-01-08 12:40:09 +08:00 committed by GitHub
commit 2f709fa8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -1318,9 +1318,7 @@ int32_t shellExecute() {
if(shell.args.is_bi_mode) {
// need set bi mode
printf("Set BI mode is true.\n");
#ifdef WEBSOCKET
//ws_taos_set_conn_mode(shell.ws_conn, TAOS_CONN_MODE_BI, 1);
#else
#ifndef WEBSOCKET
taos_set_conn_mode(shell.conn, TAOS_CONN_MODE_BI, 1);
#endif
}

View File

@ -30,7 +30,16 @@ int shell_conn_ws_server(bool first) {
fprintf(stdout, "trying to connect %s****** ", cuttedDsn);
fflush(stdout);
for (int i = 0; i < shell.args.timeout; i++) {
shell.ws_conn = ws_connect_with_dsn(shell.args.dsn);
if(shell.args.is_bi_mode) {
size_t len = strlen(shell.args.dsn);
char * dsn = taosMemoryMalloc(len + 32);
sprintf(dsn, "%s&conn_mode=1", shell.args.dsn);
shell.ws_conn = ws_connect_with_dsn(dsn);
taosMemoryFree(dsn);
} else {
shell.ws_conn = ws_connect_with_dsn(shell.args.dsn);
}
if (NULL == shell.ws_conn) {
int errNo = ws_errno(NULL);
if (0xE001 == errNo) {