Skip to content

Commit 507eb36

Browse files
committed
session UPDATE properly close SSH sessions
When a client DCs, send <close-session> + SSH EOF before waiting for <ok> reply. When server goes to free its session it polls for the SSH_EOF and this avoids socket exception warnings from libssh.
1 parent 7edad27 commit 507eb36

5 files changed

Lines changed: 251 additions & 125 deletions

File tree

src/io.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,12 @@ nc_write_msg_io(struct nc_session *session, int io_timeout, int type, ...)
861861
op = va_arg(ap, struct lyd_node *);
862862
attrs = va_arg(ap, const char *);
863863

864+
if (session->ctx != LYD_CTX(op)) {
865+
ERR(session, "RPC \"%s\" was created in different context than that of the session.", LYD_NAME(op));
866+
ret = NC_MSG_ERROR;
867+
goto cleanup;
868+
}
869+
864870
/* <rpc> open */
865871
count = asprintf(&buf, "<rpc xmlns=\"%s\" message-id=\"%" PRIu64 "\"%s>",
866872
NC_NS_BASE, session->opts.client.msgid + 1, attrs ? attrs : "");

0 commit comments

Comments
 (0)