From 32ff4cabe80a1ec7ba7f72cbc2dd46ac921682da Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 6 Jul 2023 11:51:51 -0700 Subject: modules/rkt: fix scener send error handling Silly typo, one of those fun C instances where it's surprising how silently mostly-working such a blatant mistake can be. For posterity: The way this was even observed as having an affect is while verifying graceful handling of connections broken while in the listen backlog. With an active scener session idle at the prompt, start another telnet, connecting without receiving any banner (queued via backlog), ^]cl that backlogged telnet. Then start another telnet in the same way. Now go to the idle scener session and quit. The latest telnet would just sit there, seemingly blocked behind the broken-while-backlogged connection. But what was really happening was the banner send got the error on the broken connection after accepting, as you'd expect. This bug in the errno tests prevented detecting the genuine error though, leaving the broken session connected indefinitely. Fun! --- src/modules/rkt/rkt_scener.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/rkt/rkt_scener.c b/src/modules/rkt/rkt_scener.c index 8f134bb..e8fa67f 100644 --- a/src/modules/rkt/rkt_scener.c +++ b/src/modules/rkt/rkt_scener.c @@ -735,7 +735,7 @@ int rkt_scener_update(rkt_context_t *ctxt) ret = send(scener->client, &buf[scener->output_pos], len - scener->output_pos, MSG_NOSIGNAL); if (ret == -1) { - if (errno == EAGAIN || EWOULDBLOCK) + if (errno == EAGAIN || errno == EWOULDBLOCK) return 0; return rkt_scener_err_close(scener, errno); -- cgit v1.2.3