[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: newspost unexpected response



--- Tong Sun <suntong001@yahoo.com> wrote:
> First of all, thanks for this wonderful piece of tool.  I've tried

Hi again Jim,

Over a month ago, I reported a posting problem with newspost and
teranews. The problem comes so often that I decided to look into it.
The result, I have now a fix for a more robust newspost that will
survive some insane news server status.

The symptom was:

-----
| WARNING: unexpected server response: 240 Article Posted
| Retrying
| WARNING: unexpected server response: 240 Article Posted
| Retrying
| Socket error: Broken pipe
`-----

The "Broken pipe" error, causes the whole posting to a stop. 

The reason is that, the unexpected server response, "240 Article
Posted" was not after the article posted, but right after issuing the
POST command. 

I modified the base/nntp.c to reveal the error:

- - - - >8 - - - -
	if (strncmp(response, NNTP_PROCEED_WITH_POST, 3) != 0) {
		/* this shouldn't really happen */
		fprintf(stderr,	"\ncase1 %02x %02x %02x, %s",
			response[0], response[1], response[2], response);
		ui_nntp_unknown_response(response);
		return NORMAL;
		return POSTING_FAILED;
	}
- - - - >8 - - - -

- - - - >8 - - - -
Posting part 67 of 78: done.                    
 case1 32 34 30, WARNING: unexpected server response: 240 Article
Posted
Posting part 68 of 78: done.                    
 case1 32 34 30, WARNING: unexpected server response: 240 Article
Posted
Posting part 69 of 78: done.                    
[..]
Posting part 71 of 78: done.                    
 case1 32 34 30, WARNING: unexpected server response: 240 Article
Posted
Posting part 72 of 78: done.                    

Socket error: Broken pipe
- - - - >8 - - - -

The "case2" is before the other place that calls the "unexpected server
response" procedure, which was never hit.

You can see once the news server gets into this insane status, waiting
and retrying won't help. So I change the program to reconnect if this
"shouldn't really happen" happens.

I kept the modification to the minimum, which is attached in the email.

The minimum modification have proven to be very effective. I've noticed
that it can resume posting successfully as many times as it requires
during my post:

Posting part 24 of 45: done.                    
Posting part 25 of 45: done.                    

 32 34 30, WARNING: unexpected server response: 240 Article Posted
Retrying
Connecting to free.teranews.com... done.
Logging on to free.teranews.com... done.
Posting part 26 of 45: done.                    

Posting part 31 of 45: done.                    

 32 34 30, WARNING: unexpected server response: 240 Article Posted
Retrying
Connecting to free.teranews.com... done.
Logging on to free.teranews.com... done.
Posting part 32 of 45: done.                    

Posting part 82 of 86: done.                    

 32 34 30, WARNING: unexpected server response: 240 Article Posted
Retrying
Connecting to free.teranews.com... done.
Logging on to free.teranews.com... done.
Posting part 83 of 86: done.                    

I hope you can incorporate my modification in future version of
newspost, so others can benefit from the modification also. 

Debian QA Group, I didn't get any feed back from Jim last time, could
you help me correspond with me, or at least incorporate my modification
in Debian please, since the last version was several years old, so it
is safe to do so.

thanks

tong



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more. 
http://info.mail.yahoo.com/mail_250
--- newspost-2.1.1/base/nntp.c	2003-04-23 11:33:23.000000000 -0400
+++ ../newspost-2.1.1/base/nntp.c	2005-03-08 11:07:01.000000000 -0500
@@ -80,2 +80,31 @@
 	      boolean no_ui_updates) {
+	int retval = _nntp_post(subject, data, buffer, length, no_ui_updates);
+
+	if (retval == POSTING_FAILED-64) {
+		/* try log out then back in */
+		ui_nntp_posting_retry();
+		nntp_logoff();
+		socket_close();
+		sleep(5);
+
+		/* create the socket */
+		ui_socket_connect_start(data->address->data);
+		retval = socket_create(data->address->data, data->port);
+		if (retval < 0)
+			return retval;
+		ui_socket_connect_done();
+
+		ui_nntp_logon_start(data->address->data);
+		if (nntp_logon(data) == FALSE)
+			return POSTING_FAILED;
+		ui_nntp_logon_done();
+
+		retval = _nntp_post(subject, data, buffer, length, no_ui_updates);
+		}
+	return retval;
+}
+
+int _nntp_post(const char *subject, newspost_data *data, 
+	      const char *buffer, long length,
+	      boolean no_ui_updates) {
 	char response[STRING_BUFSIZE];
@@ -97,3 +126,3 @@
 		ui_nntp_unknown_response(response);
-		return POSTING_FAILED;
+		return POSTING_FAILED-64;
 	}

Reply to: