Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8722) Fatal bugs and annoyances (resent)
Home

[Freeciv-Dev] Re: (PR#8722) Fatal bugs and annoyances (resent)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: vasc@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8722) Fatal bugs and annoyances (resent)
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Thu, 13 May 2004 12:51:51 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8722 >

On Thu, May 13, 2004 at 02:18:50AM -0700, Raimar Falke wrote:
> 1) The generated packet code has to cope with closed connections since
> connections can be closed at almost any time. It would be to hard for
> the common code to catch this and abort its execution. I will provide
> a patch for this.

The patch.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "The BeOS takes the best features from the major operating systems. 
  It's got the power and flexibility of Unix, the interface and ease 
  of use of the MacOS, and Minesweeper from Windows."

Index: common/generate_packets.py
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/generate_packets.py,v
retrieving revision 1.11
diff -u -u -r1.11 generate_packets.py
--- common/generate_packets.py  4 May 2004 17:40:26 -0000       1.11
+++ common/generate_packets.py  13 May 2004 19:49:02 -0000
@@ -1105,6 +1105,12 @@
 
         result='''%(receive_prototype)s
 {
+  if(!pc->used) {
+    freelog(LOG_ERROR,
+           "WARNING: trying to read data from the closed connection %%s",
+           conn_description(pc));
+    return NULL;
+  }
   assert(pc->phs.variant != NULL);
 %(restrict)s  ensure_valid_variant_%(name)s(pc);
 
@@ -1135,6 +1141,12 @@
 
         result='''%(send_prototype)s
 {
+  if(!pc->used) {
+    freelog(LOG_ERROR,
+           "WARNING: trying to send data to the closed connection %%s",
+           conn_description(pc));
+    return -1;
+  }
   assert(pc->phs.variant != NULL);
 %(restrict)s  ensure_valid_variant_%(name)s(pc);
 

[Prev in Thread] Current Thread [Next in Thread]