Article View: news.software.readers
Article #28149Re: known bug in slrn?
From: John E. Davis
Date: Fri, 06 Dec 1996 00:00
Date: Fri, 06 Dec 1996 00:00
104 lines
3401 bytes
3401 bytes
On 2 Dec 1996 14:40:22 GMT, Louis-David Mitterrand <mito@retriever.qc>
wrote:
>Whenever I loose my PPP connection to my ISP while using slrn and then
>reconnect (under a different random IP address) slrn (0.9.1.1 on Linux)
>hangs forever. I can't even kill the session from the terminal with ^-C.
Exactly how do you reconnect? Do you start a new slrn process? If
so, I do not see why it should hang. Please try the following patches
to slrn/src/sltcp.c and slrn/src/sltcp.h. Also qnote that other
posters have incorrectly assumed that slrn uses slrn/src/clientlib.c
under Unix; clientlib.c is only used by VMS.
The patches follow. If they solve your problem or create new
problems, please let me know!
% diff -u release/slrn/src/sltcp.c slrn/src/sltcp.c
--- release/slrn/src/sltcp.h Tue Oct 22 14:08:32 1996
+++ slrn/src/sltcp.h Fri Dec 6 00:04:56 1996
@@ -6,6 +6,7 @@
typedef struct
{
int tcp_fd;
+#define SLTCP_EOF_FLAG 0x1
unsigned int tcp_flags;
unsigned char *tcp_write_ptr;
unsigned char *tcp_write_ptr_min;
diff -u release/slrn/src/sltcp.c slrn/src/sltcp.c
--- release/slrn/src/sltcp.c Tue Oct 22 14:08:32 1996
+++ slrn/src/sltcp.c Fri Dec 6 00:15:41 1996
@@ -344,14 +344,20 @@
}
/*}}}*/
-static int do_read (int fd, unsigned char *buf, unsigned int len)
+
+static int do_read (SLTCP_Type *tcp)
{
- int nread;
+ int nread, fd;
+ if (tcp->tcp_flags & SLTCP_EOF_FLAG)
+ return -1;
+
+ fd = tcp->tcp_fd;
+
if (-1 == wait_for_input (fd))
return -1;
- while (-1 == (nread = SLTCP_READ (fd, (char *)buf, len)))
+ while (-1 == (nread = SLTCP_READ (fd, (char *)tcp->tcp_read_ptr, SLTCP_BUF_SIZE)))
{
if (errno == EINTR)
{
@@ -362,6 +368,9 @@
return -1;
}
+ if (nread == 0)
+ tcp->tcp_flags |= SLTCP_EOF_FLAG;
+
return nread;
}
@@ -404,7 +413,7 @@
tcp->tcp_read_ptr = tcp->tcp_read_ptr_max = tcp->tcp_read_buf;
- nread = do_read (fd, tcp->tcp_read_ptr, SLTCP_BUF_SIZE);
+ nread = do_read (tcp);
if (-1 == nread)
return total_len;
@@ -493,7 +502,7 @@
while (1)
{
- unsigned int nread;
+ int nread;
r = tcp->tcp_read_ptr;
rmax = tcp->tcp_read_ptr_max;
@@ -522,10 +531,9 @@
tcp->tcp_read_ptr_max = tcp->tcp_read_ptr = tcp->tcp_read_buf;
- nread = (unsigned int) do_read (fd, tcp->tcp_read_ptr, SLTCP_BUF_SIZE);
- if (-1 == (int)nread)
+ if (-1 == (nread = do_read (tcp)))
return -1;
- tcp->tcp_read_ptr_max += nread;
+ tcp->tcp_read_ptr_max += (unsigned int) nread;
}
}
--
John E. Davis Center for Space Research/AXAF Science Center
617-258-8119 MIT 37-662c, Cambridge, MA 02139
http://space.mit.edu/~davis
Technical Details
Message-ID:
<slrn5afbgd.ler.davis@aluche.mit.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn5a5qju.kr.mito@retriever.qc>Show Full Headers
Complete Article Headers
Message-ID: <slrn5afbgd.ler.davis@aluche.mit.edu> Subject: Re: known bug in slrn? Date: Fri, 06 Dec 1996 00:00:00 +0000 From: davis@space.mit.edu (John E. Davis) References: <slrn5a5qju.kr.mito@retriever.qc> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 202633871 Organization: Center for Space Research Reply-to: davis@space.mit.edu Newsgroups: news.software.readers