Internal framing: fcgi error
CLI continue error enable msg recv interrupt
This commit is contained in:
parent
520f8a9a42
commit
4138f390d4
7 changed files with 37 additions and 15 deletions
|
|
@ -1860,7 +1860,7 @@ from_client(int s,
|
|||
}
|
||||
if (ce_client_descr(ce, &cbce) < 0)
|
||||
goto done;
|
||||
if (clixon_msg_rcv11(s, NULL, &cb, &eof) < 0)
|
||||
if (clixon_msg_rcv11(s, NULL, 0, &cb, &eof) < 0)
|
||||
goto done;
|
||||
if (eof){
|
||||
backend_client_rm(h, ce);
|
||||
|
|
|
|||
|
|
@ -1408,7 +1408,7 @@ cli_notification_cb(int s,
|
|||
enum format_enum format = (enum format_enum)(uintptr_t)arg;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
if (clixon_msg_rcv11(s, NULL, &cb, &eof) < 0)
|
||||
if (clixon_msg_rcv11(s, NULL, 0, &cb, &eof) < 0)
|
||||
goto done;
|
||||
if (eof){
|
||||
clixon_err(OE_PROTO, ESHUTDOWN, "Socket unexpected close");
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ netconf_notification_cb(int s,
|
|||
|
||||
clixon_debug(CLIXON_DBG_NETCONF, "");
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if (clixon_msg_rcv11(s, NULL, &cbmsg, &eof) < 0)
|
||||
if (clixon_msg_rcv11(s, NULL, 0, &cbmsg, &eof) < 0)
|
||||
goto done;
|
||||
/* handle close from remote end: this will exit the client */
|
||||
if (eof){
|
||||
|
|
|
|||
|
|
@ -211,14 +211,13 @@ restconf_stream_cb(int s,
|
|||
cxobj *xtop = NULL; /* top xml */
|
||||
cxobj *xn; /* notification xml */
|
||||
cbuf *cb = NULL;
|
||||
int pretty = 0; /* XXX should be via arg */
|
||||
cbuf *cbmsg = NULL;
|
||||
int pretty = 0; /* XXX should be via arg */
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_STREAM, "");
|
||||
if (clixon_msg_rcv11(s, NULL, &cbmsg, &eof) < 0)
|
||||
if (clixon_msg_rcv11(s, NULL, 0, &cbmsg, &eof) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_STREAM, "msg: %s", reply?reply->op_body:"null");
|
||||
/* handle close from remote end: this will exit the client */
|
||||
if (eof){
|
||||
clixon_debug(CLIXON_DBG_STREAM, "eof");
|
||||
|
|
@ -230,7 +229,7 @@ restconf_stream_cb(int s,
|
|||
clixon_exit_set(1);
|
||||
goto done;
|
||||
}
|
||||
if ((ret = clixon_xml_parse_string(cbuf_get(cbmsg), YB_NONE, NULL, &xt, NULL)) < 0)
|
||||
if ((ret = clixon_xml_parse_string(cbuf_get(cbmsg), YB_NONE, NULL, &xtop, NULL)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_err(OE_XML, EFAULT, "Invalid notification");
|
||||
|
|
@ -266,8 +265,6 @@ restconf_stream_cb(int s,
|
|||
clixon_debug(CLIXON_DBG_STREAM, "retval: %d", retval);
|
||||
if (xtop != NULL)
|
||||
xml_free(xtop);
|
||||
if (reply)
|
||||
free(reply);
|
||||
if (cbmsg)
|
||||
cbuf_free(cbmsg);
|
||||
if (cb)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ int clixon_msg_send10(int s, const char *descr, cbuf *cb);
|
|||
int clixon_rpc10(int sock, const char *descr, cbuf *msgin, cbuf *msgret, int *eof);
|
||||
|
||||
/* NETCONF 1.1 */
|
||||
int clixon_msg_rcv11(int s, const char *descr, cbuf **cb, int *eof);
|
||||
int clixon_msg_rcv11(int s, const char *descr, int intr, cbuf **cb, int *eof);
|
||||
int clicon_rpc(int sock, const char *descr, struct clicon_msg *msg, char **xret, int *eof);
|
||||
int send_msg_reply(int s, const char *descr, char *data, uint32_t datalen);
|
||||
int send_msg_notify_xml(clixon_handle h, int s, const char *descr, cxobj *xev);
|
||||
|
|
|
|||
|
|
@ -572,9 +572,17 @@ clixon_msg_send11(int s,
|
|||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
atomicio_sig_handler(int arg)
|
||||
{
|
||||
_atomicio_sig++;
|
||||
}
|
||||
|
||||
/*! Receive a message using unified NETCONF w chunked framing
|
||||
*
|
||||
* @param[in] s socket (unix or inet) to communicate with backend
|
||||
* @param[in] descr Description of peer for logging
|
||||
* @param[in] intr If set, make a ^C cause an error (OBSOLETE?)
|
||||
* @param[out] cb cligen buf struct containing the incoming message
|
||||
* @param[out] eof Set if eof encountered
|
||||
* @retval 0 OK (check eof)
|
||||
|
|
@ -585,6 +593,7 @@ clixon_msg_send11(int s,
|
|||
int
|
||||
clixon_msg_rcv11(int s,
|
||||
const char *descr,
|
||||
int intr,
|
||||
cbuf **cb,
|
||||
int *eof)
|
||||
{
|
||||
|
|
@ -600,12 +609,22 @@ clixon_msg_rcv11(int s,
|
|||
int eom = 0;
|
||||
cxobj *xtop = NULL;
|
||||
cxobj *xerr = NULL;
|
||||
sigset_t oldsigset;
|
||||
struct sigaction oldsigaction[32] = {{{0,},},};
|
||||
|
||||
if ((cbmsg = cbuf_new()) == NULL){
|
||||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
eom = 0;
|
||||
*eof = 0;
|
||||
if (intr){
|
||||
if (clixon_signal_save(&oldsigset, oldsigaction) < 0)
|
||||
goto done;
|
||||
set_signal(SIGINT, SIG_IGN, NULL);
|
||||
clicon_signal_unblock(SIGINT);
|
||||
set_signal_flags(SIGINT, 0, atomicio_sig_handler, NULL);
|
||||
}
|
||||
while (*eof == 0 && eom == 0) {
|
||||
/* Read input data from socket and append to cbbuf */
|
||||
if ((len = netconf_input_read2(s, buf, buflen, eof)) < 0)
|
||||
|
|
@ -638,6 +657,10 @@ clixon_msg_rcv11(int s,
|
|||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG|CLIXON_DBG_DETAIL, "%s done", __FUNCTION__);
|
||||
if (intr){
|
||||
if (clixon_signal_restore(&oldsigset, oldsigaction) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (cbmsg)
|
||||
cbuf_free(cbmsg);
|
||||
if (xtop)
|
||||
|
|
@ -680,7 +703,7 @@ clicon_rpc(int sock,
|
|||
goto done;
|
||||
if (cbsend)
|
||||
cbuf_free(cbsend);
|
||||
if (clixon_msg_rcv11(sock, descr, &cbrcv, eof) < 0)
|
||||
if (clixon_msg_rcv11(sock, descr, 0, &cbrcv, eof) < 0)
|
||||
goto done;
|
||||
if (*eof)
|
||||
goto ok;
|
||||
|
|
@ -693,7 +716,7 @@ clicon_rpc(int sock,
|
|||
}
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (reply)
|
||||
free(reply);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ function testinit(){
|
|||
|
||||
new "wait backend"
|
||||
wait_backend
|
||||
|
||||
|
||||
if [ $SN -ne 0 ]; then
|
||||
# Kill old clixon_snmp, if any
|
||||
new "Terminating any old clixon_snmp processes"
|
||||
|
|
@ -269,8 +269,10 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
sudo pkill -f clixon_backend
|
||||
|
||||
new "Starting backend"
|
||||
fi
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Starting backend -s startup -f $cfg -- -V CLIXON-TYPES-MIB/clixonExampleScalars/clixonExampleInteger"
|
||||
start_backend -s startup -f $cfg -- -V CLIXON-TYPES-MIB/clixonExampleScalars/clixonExampleInteger
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue