Memory leak/err in notification when closing down
test: restconf notification chunked framing update
This commit is contained in:
parent
feec3a21d9
commit
600f0616f6
3 changed files with 12 additions and 7 deletions
|
|
@ -444,7 +444,7 @@ netconf_notification_cb(int s,
|
|||
struct clicon_msg *reply = NULL;
|
||||
int eof;
|
||||
int retval = -1;
|
||||
cbuf *cb;
|
||||
cbuf *cb = NULL;
|
||||
cxobj *xn = NULL; /* event xml */
|
||||
cxobj *xt = NULL; /* top xml */
|
||||
clicon_handle h = (clicon_handle)arg;
|
||||
|
|
@ -485,17 +485,22 @@ netconf_notification_cb(int s,
|
|||
goto done;
|
||||
/* Send it to listening client on stdout */
|
||||
if (netconf_output_encap(clicon_option_int(h, "netconf-framing"), cb) < 0){
|
||||
cbuf_free(cb);
|
||||
goto done;
|
||||
}
|
||||
if (netconf_output(1, cb, "notification") < 0)
|
||||
if (netconf_output(1, cb, "notification") < 0){
|
||||
clicon_err(OE_PROTO, ESHUTDOWN, "Socket unexpected close");
|
||||
close(s);
|
||||
errno = ESHUTDOWN;
|
||||
clixon_event_unreg_fd(s, netconf_notification_cb);
|
||||
goto done;
|
||||
}
|
||||
fflush(stdout);
|
||||
cbuf_free(cb);
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clicon_debug(1, "%s %d", __FUNCTION__, retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
if (nsc)
|
||||
xml_nsctx_free(nsc);
|
||||
if (xt != NULL)
|
||||
|
|
|
|||
|
|
@ -2003,7 +2003,7 @@ netconf_output(int s,
|
|||
}
|
||||
if (write(s, buf, len) < 0){
|
||||
if (errno == EPIPE)
|
||||
;
|
||||
clicon_debug(1, "%s write err SIGPIPE", __FUNCTION__);
|
||||
else
|
||||
clicon_log(LOG_ERR, "%s: write: %s", __FUNCTION__, strerror(errno));
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ cat <<EOF > $cfg
|
|||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||
<CLICON_BACKEND_PIDFILE>$dir/restconf.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
|
||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||
|
|
@ -140,7 +140,7 @@ new "wait restconf"
|
|||
wait_restconf
|
||||
|
||||
new "netconf event stream discovery RFC8040 Sec 6.2"
|
||||
expecteof "$clixon_netconf -D $DBG -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"r:restconf-state/r:streams\" xmlns:r=\"urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring\"/></get></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><data><restconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring\"><streams><stream><name>EXAMPLE</name><description>Example event stream</description><replay-support>true</replay-support><access><encoding>xml</encoding><location>https://localhost/streams/EXAMPLE</location></access></stream></streams></restconf-state></data></rpc-reply>]]>]]>"
|
||||
expecteof_netconf "$clixon_netconf -D $DBG -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"r:restconf-state/r:streams\" xmlns:r=\"urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring\"/></get></rpc>" "" "<rpc-reply $DEFAULTNS><data><restconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring\"><streams><stream><name>EXAMPLE</name><description>Example event stream</description><replay-support>true</replay-support><access><encoding>xml</encoding><location>https://localhost/streams/EXAMPLE</location></access></stream></streams></restconf-state></data></rpc-reply>"
|
||||
|
||||
#
|
||||
# 1.2 Netconf stream subscription
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue