[tin-dev] -C and timeout after reconnect

Urs Janßen urs at tin.org
Wed Jun 7 14:49:28 CEST 2023


I noticed that when the connection was closed from the servers side
while I was composing an article the reconnect and post does succeed
but tin directly terminates afterwards with signal_handler(SIGALRM)
("get_server() %d sec elapsed without response", tinrc.nntp_read_timeout_secs)

Eneabeling DEBUG_IO in debug.h and capturing stderr was useful.

nntp_read_timeout_secs is likely elapsed before resending the commands
on reconnect and not reset while doing so.

Strangely I could only see this when running tin with -C (and the server
does support it (INN 2.6.1)).

The following should fix that - but please could someone review it?

=== modified file 'src/nntplib.c'
--- src/nntplib.c	2023-06-01 09:34:32 +0000
+++ src/nntplib.c	2023-06-07 10:39:49 +0000
@@ -930,6 +930,9 @@
 
 	/* reset signal_context */
 	signal_context = save_signal_context;
+#	if defined(HAVE_ALARM) && defined(SIGALRM)
+		alarm((unsigned) tinrc.nntp_read_timeout_secs);
+#	endif /* HAVE_ALARM && SIGALRM */
 
 	clear_message();
 	strcpy(buf, last_put);			/* Keep copy here, it will be clobbered a lot otherwise */
@@ -954,6 +957,10 @@
 		retry = NNTP_TRY_RECONNECT;
 	}
 
+#	if defined(HAVE_ALARM) && defined(SIGALRM)
+		alarm(0);
+#	endif /* HAVE_ALARM && SIGALRM */
+
 	return retry;
 }



More information about the tin-dev mailing list