Skip to content

Commit c185e40

Browse files
Roytakmichalvasko
authored andcommitted
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 4c14160 commit c185e40

5 files changed

Lines changed: 265 additions & 129 deletions

File tree

src/io.c

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

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

0 commit comments

Comments
 (0)