moved initial hello request from client to backend to immediate before first actual query
This commit is contained in:
parent
84c94b2c0e
commit
948e203a61
5 changed files with 36 additions and 11 deletions
|
|
@ -599,7 +599,11 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* Go into event-loop unless -1 command-line */
|
/* Go into event-loop unless -1 command-line */
|
||||||
if (!once){
|
if (!once){
|
||||||
/* send hello request from backend hello */
|
/* Send hello request to backend to get session-id back
|
||||||
|
* This is done once at the beginning of the session and then this is
|
||||||
|
* used by the client, even though new TCP sessions are created for
|
||||||
|
* each message sent to the backend.
|
||||||
|
*/
|
||||||
if (clicon_hello_req(h, &id) < 0)
|
if (clicon_hello_req(h, &id) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
clicon_session_id_set(h, id);
|
clicon_session_id_set(h, id);
|
||||||
|
|
|
||||||
|
|
@ -562,11 +562,16 @@ main(int argc,
|
||||||
clicon_session_id_set(h, getpid());
|
clicon_session_id_set(h, getpid());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* send hello request from backend hello */
|
/* Send hello request to backend to get session-id back
|
||||||
|
* This is done once at the beginning of the session and then this is
|
||||||
|
* used by the client, even though new TCP sessions are created for
|
||||||
|
* each message sent to the backend.
|
||||||
|
*/
|
||||||
if (clicon_hello_req(h, &id) < 0)
|
if (clicon_hello_req(h, &id) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
clicon_session_id_set(h, id);
|
clicon_session_id_set(h, id);
|
||||||
|
|
||||||
|
/* Send hello to northbound client */
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
send_hello(h, 1, id);
|
send_hello(h, 1, id);
|
||||||
if (event_reg_fd(0, netconf_input_cb, h, "netconf socket") < 0)
|
if (event_reg_fd(0, netconf_input_cb, h, "netconf socket") < 0)
|
||||||
|
|
|
||||||
|
|
@ -584,7 +584,8 @@ main(int argc,
|
||||||
yang_stmt *yspec = NULL;
|
yang_stmt *yspec = NULL;
|
||||||
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
|
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
|
||||||
char *stream_path;
|
char *stream_path;
|
||||||
int finish;
|
int finish = 0;
|
||||||
|
int start = 1;
|
||||||
char *str;
|
char *str;
|
||||||
clixon_plugin *cp = NULL;
|
clixon_plugin *cp = NULL;
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
|
|
@ -781,10 +782,6 @@ main(int argc,
|
||||||
clicon_err(OE_CFG, errno, "FCGX_OpenSocket");
|
clicon_err(OE_CFG, errno, "FCGX_OpenSocket");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* send hello request from backend hello */
|
|
||||||
if (clicon_hello_req(h, &id) < 0)
|
|
||||||
goto done;
|
|
||||||
clicon_session_id_set(h, id);
|
|
||||||
|
|
||||||
if (clicon_socket_set(h, sock) < 0)
|
if (clicon_socket_set(h, sock) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -805,6 +802,19 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
clicon_debug(1, "------------");
|
clicon_debug(1, "------------");
|
||||||
|
|
||||||
|
if (start == 0){
|
||||||
|
/* Send hello request to backend to get session-id back
|
||||||
|
* This is done once at the beginning of the session and then this is
|
||||||
|
* used by the client, even though new TCP sessions are created for
|
||||||
|
* each message sent to the backend.
|
||||||
|
*/
|
||||||
|
if (clicon_hello_req(h, &id) < 0)
|
||||||
|
goto done;
|
||||||
|
clicon_session_id_set(h, id);
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
|
||||||
if ((path = FCGX_GetParam("REQUEST_URI", r->envp)) != NULL){
|
if ((path = FCGX_GetParam("REQUEST_URI", r->envp)) != NULL){
|
||||||
clicon_debug(1, "path: %s", path);
|
clicon_debug(1, "path: %s", path);
|
||||||
if (strncmp(path, "/" RESTCONF_API, strlen("/" RESTCONF_API)) == 0)
|
if (strncmp(path, "/" RESTCONF_API, strlen("/" RESTCONF_API)) == 0)
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,11 @@ if [ $# -gt 0 ]; then
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Pattern to run tests, default is all, but you may want to narrow it down
|
||||||
|
: ${pattern:=test_*.sh}
|
||||||
|
|
||||||
err=0
|
err=0
|
||||||
for testfile in test*.sh; do # For lib.sh the variable must be called testfile
|
for testfile in $pattern; do # For lib.sh the variable must be called testfile
|
||||||
echo "Running $testfile"
|
echo "Running $testfile"
|
||||||
./$testfile > /dev/null 2>&1
|
./$testfile > /dev/null 2>&1
|
||||||
errcode=$?
|
errcode=$?
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,18 @@ EOF
|
||||||
start_backend -s init -f $cfg
|
start_backend -s init -f $cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
new "waiting"
|
||||||
|
wait_backend
|
||||||
|
|
||||||
new "$clixon_cli -1f $cfg show version"
|
new "$clixon_cli -1f $cfg show version"
|
||||||
expectfn "$clixon_cli -1f $cfg show version" 0 "$version."
|
expectfn "$clixon_cli -1f $cfg show version" 0 "$version."
|
||||||
|
|
||||||
new "hello session-id 1"
|
|
||||||
expecteof "$clixon_util_socket -a $family -s $sock -D $DBG" 0 "<hello/>" "<hello><session-id>1</session-id></hello>"
|
|
||||||
|
|
||||||
new "hello session-id 2"
|
new "hello session-id 2"
|
||||||
expecteof "$clixon_util_socket -a $family -s $sock -D $DBG" 0 "<hello/>" "<hello><session-id>2</session-id></hello>"
|
expecteof "$clixon_util_socket -a $family -s $sock -D $DBG" 0 "<hello/>" "<hello><session-id>2</session-id></hello>"
|
||||||
|
|
||||||
|
new "hello session-id 2"
|
||||||
|
expecteof "$clixon_util_socket -a $family -s $sock -D $DBG" 0 "<hello/>" "<hello><session-id>3</session-id></hello>"
|
||||||
|
|
||||||
if [ $BE -ne 0 ]; then
|
if [ $BE -ne 0 ]; then
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if premature kill
|
# Check if premature kill
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue