[tin-dev] -C and timeout with low nntp_read_timeout_secs and huge group
Urs Janßen
urs at tin.org
Thu Jul 20 00:59:47 CEST 2023
In <mailman.1679.1689802465.1791.tin-dev at tin.org> on Wed, 19 Jul 2023 23:34:23,
I wrote:
> - batch_mode = TRUE; /* Suppress some unwanted on-screen garbage */
> - if ((start_groupnum = check_start_save_any_news(START_ANY_NEWS, catchup)) == -1) {
> - batch_mode = FALSE;
> + if ((start_groupnum = check_start_save_any_news(START_ANY_NEWS, catchup)) == -1)
> tin_done(EXIT_SUCCESS, NULL);
> - }
> - batch_mode = FALSE;
introduce '-t sec' cmd-line option (most useful for batch_mode); we could
undo the above but I tend to keep that as well.
=== modified file 'doc/tin.1'
--- doc/tin.1 2023-07-11 07:56:38 +0000
+++ doc/tin.1 2023-07-19 22:50:55 +0000
@@ -43,6 +43,8 @@
.IR Mail_dir \|]
.RB [\| \-p
.IR port \|]
+.RB [\| \-t
+.IR timeout \|]
.RB [\| \-I
.IR index_dir \|]\ \|[ newsgroup \|[\|,.\|.\|.\|]\|]\|]
.\"
@@ -230,6 +233,9 @@
Save unread articles for later reading by the ''\fB\-R\fP'' option. For more
information read section "AUTOMATIC MAILING AND SAVING NEW NEWS".
.TP
+.BI \-t " timeout"
+Override the \fBnntp_read_timeout_secs\fP setting. Default is 120 seconds.
+.TP
.B \-T
Enable NNTPS (NNTP over TLS). This also overrides the environment
variable $\fBNNTPPORT\fP if set. Only available when reading via NNTP.
=== modified file 'include/tin.h'
--- include/tin.h 2023-05-10 14:21:31 +0000
+++ include/tin.h 2023-07-19 22:39:43 +0000
@@ -1154,6 +1154,7 @@
#define CMDLINE_NNTPSERVER 4
#define CMDLINE_SAVEDIR 8
#define CMDLINE_USE_COLOR 16
+#define CMDLINE_NNTP_TIMEOUT 32
/*
@@ -1547,10 +1548,11 @@
*/
struct t_cmdlineopts {
int getart_limit; /* getart_limit */
+ int nntp_timeout; /* nntp_read_timeout_secs */
char maildir[PATH_LEN]; /* maildir */
char nntpserver[PATH_LEN]; /* nntpserver */
char savedir[PATH_LEN]; /* savedir */
- unsigned int args:5; /* given options */
+ unsigned int args:6; /* given options */
};
/*
=== modified file 'src/config.c'
--- src/config.c 2022-11-03 11:55:26 +0000
+++ src/config.c 2023-07-19 22:38:33 +0000
@@ -555,8 +555,15 @@
#if defined(HAVE_ALARM) && defined(SIGALRM)
/* the number of seconds is limited on some systems (e.g. Free/OpenBSD: 100000000) */
- if (match_integer(buf, "nntp_read_timeout_secs=", &tinrc.nntp_read_timeout_secs, 16383))
+ if (match_integer(buf, "nntp_read_timeout_secs=", &tinrc.nntp_read_timeout_secs, 16383)) {
+# ifdef NNTP_ABLE
+ int timeout = (cmdline.args & CMDLINE_NNTP_TIMEOUT) ? cmdline.nntp_timeout : tinrc.nntp_read_timeout_secs;
+
+ tinrc.nntp_read_timeout_secs = timeout;
+# endif /* NNTP_ABLE */
break;
+ }
#endif /* HAVE_ALARM && SIGALRM */
#ifdef HAVE_UNICODE_NORMALIZATION
=== modified file 'src/main.c'
--- src/main.c 2023-06-26 16:39:10 +0000
+++ src/main.c 2023-07-19 22:27:56 +0000
@@ -466,7 +462,7 @@
/*
* process command line options
- * [01235789beEFijJKLOtyY] are unused
+ * [01235789beEFijJKLOyY] are unused
* [W] is reserved
* [BPU] have been in use at some time, but now are unused:
* B BBS mode (M_AMIGA only)
@@ -475,7 +471,7 @@
* reused with different function:
* C was count articles, now is activate COMPRESS DEFLATE
*/
-#define OPTIONS "46aAcCdD:f:g:G:hHI:klm:M:nNop:qQrRs:STuvVwxXzZ"
+#define OPTIONS "46aAcCdD:f:g:G:hHI:klm:M:nNop:qQrRs:St:TuvVwxXzZ"
static void
read_cmd_line_options(
@@ -754,6 +750,19 @@
batch_mode = TRUE;
break;
+ case 't':
+#if defined(NNTP_ABLE) && defined(HAVE_ALARM) && defined(SIGALRM)
+ cmdline.nntp_timeout = atoi(optarg);
+ cmdline.args |= CMDLINE_NNTP_TIMEOUT;
+#else
+ error_message(2, _(txt_option_not_enabled), "-DNNTP_ABLE");
+ free_all_arrays();
+ giveup();
+ /* keep lint quiet: */
+ /* NOTREACHED */
+#endif /* NNTP_ABLE && HAVE_ALARM && SIGALRM */
+ break;
+
case 'T':
#ifdef NNTPS_ABLE
use_nntps = TRUE;
More information about the tin-dev
mailing list