Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] Core on input_from_server: fd != aconnection.sock (PR#4175
Home

[Freeciv-Dev] Core on input_from_server: fd != aconnection.sock (PR#4175

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: vasc@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Core on input_from_server: fd != aconnection.sock (PR#4175)
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Jul 2003 16:22:45 -0700
Reply-to: rt@xxxxxxxxxxxxxx

I can reliably reproduce this bug with the following patch.

Here's some debugging output:

in try_to_connect
        top sock: 0
        post socket() sock: 4
        post connect() sock: 4
add_net_input() sock: 4
input_from_server: fd:4 sock:4
input_from_server: fd:4 sock:4
input_from_server: fd:4 sock:4
input_from_server: fd:4 sock:4
input_from_server: fd:4 sock:4
in try_to_connect
        top sock: 4
        post socket() sock: 7
        post connect() sock: 7
Unexpected buffers!
1: Unexpected buffers in try_to_connect()
add_net_input() sock: 7
input_from_server: fd:4 sock:7
civclient: clinet.c:329: input_from_server: Assertion `fd ==
aconnection.sock' failed.
Aborted (core dumped)

I'm wondering if remove_net_input() needs to be called and isn't...

-mike

diff -Nur -Xsnap/diff_ignore snap-a6/client/clinet.c snap-fd/client/clinet.c
--- snap-a6/client/clinet.c     2003-07-08 16:28:02.000000000 -0500
+++ snap-fd/client/clinet.c     2003-07-08 18:18:30.000000000 -0500
@@ -177,11 +177,14 @@
 {
   struct packet_login_request req;
 
+  printf("in try_to_connect\n\ttop sock: %d\n", 
aconnection.sock);fflush(stdout);/* DEBUGGING */
+
   if ((aconnection.sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
     (void) mystrlcpy(errbuf, mystrerror(errno), errbufsize);
     return -1;
   }
 
+  printf("\tpost socket() sock: %d\n", aconnection.sock);fflush(stdout);/* 
DEBUGGING */
   if (connect(aconnection.sock, (struct sockaddr *) &server_addr,
       sizeof(server_addr)) == -1) {
     (void) mystrlcpy(errbuf, mystrerror(errno), errbufsize);
@@ -194,8 +197,10 @@
 #endif
   }
 
+  printf("\tpost connect() sock: %d\n", aconnection.sock);fflush(stdout);/* 
DEBUGGING */
   if (aconnection.buffer) {
     /* didn't close cleanly previously? */
+    printf("Unexpected buffers!\n");fflush(stdout);/* DEBUGGING */
     freelog(LOG_ERROR, "Unexpected buffers in try_to_connect()");
     /* get newly initialized ones instead */
     free_socket_packet_buffer(aconnection.buffer);
@@ -319,6 +324,8 @@
 **************************************************************************/
 void input_from_server(int fd)
 {
+  printf("input_from_server: fd:%d sock:%d\n", fd, 
aconnection.sock);fflush(stdout);/* DEBUGGING */
+
   assert(fd == aconnection.sock);
 
   if (read_from_connection(&aconnection, FALSE) >= 0) {
@@ -336,6 +343,7 @@
       }
     }
   } else {
+    printf("closing socket in 'input_'\n");fflush(stdout);/* DEBUGGING */
     close_socket_callback(&aconnection);
   }
 
diff -Nur -Xsnap/diff_ignore snap-a6/client/gui-gtk/connectdlg.c 
snap-fd/client/gui-gtk/connectdlg.c
--- snap-a6/client/gui-gtk/connectdlg.c 2003-07-08 16:36:50.000000000 -0500
+++ snap-fd/client/gui-gtk/connectdlg.c 2003-07-08 17:51:19.000000000 -0500
@@ -123,6 +123,7 @@
   gtk_widget_show(dialog);
   gtk_entry_set_visibility(GTK_ENTRY(iinput), FALSE);
   gtk_set_label(ilabel, _("Password:"));
+  gtk_signal_emit_by_name(GTK_OBJECT(connw), "clicked");
 }
 
 /**************************************************************************
@@ -159,6 +160,7 @@
     gtk_entry_set_text(GTK_ENTRY(iinput), "");
     gtk_widget_grab_focus(iinput);
     dialog_config = VERIFY_PASSWORD_TYPE;
+    gtk_signal_emit_by_name(GTK_OBJECT(connw), "clicked");
     break;
   case VERIFY_PASSWORD_TYPE:
     sz_strlcpy(reply.password, gtk_entry_get_text(GTK_ENTRY(iinput)));
@@ -440,6 +442,7 @@
                       "clicked", GTK_SIGNAL_FUNC(sort_servers_callback),
                       GINT_TO_POINTER(i));
   }
+  gtk_signal_emit_by_name(GTK_OBJECT(connw), "clicked");
 }
 
 /**************************************************************************
diff -Nur -Xsnap/diff_ignore snap-a6/client/gui-gtk/gui_main.c 
snap-fd/client/gui-gtk/gui_main.c
--- snap-a6/client/gui-gtk/gui_main.c   2003-07-04 06:20:42.000000000 -0500
+++ snap-fd/client/gui-gtk/gui_main.c   2003-07-08 18:18:59.000000000 -0500
@@ -1157,6 +1157,7 @@
 **************************************************************************/
 void add_net_input(int sock)
 {
+printf("add_net_input() sock: %d\n", sock);fflush(stdout);/* DEBUGGING */
   gdk_input_id = gdk_input_add(sock, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
                               get_net_input, NULL);
   aconnection.notify_of_writable_data = set_wait_for_writable_socket;
@@ -1168,6 +1169,7 @@
 **************************************************************************/
 void remove_net_input(void)
 {
+printf("remove_net_input: %d\n",gdk_input_id);fflush(stdout);/* DEBUGGING */
   gdk_input_remove(gdk_input_id);
   gdk_window_set_cursor(root_window, NULL);
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Core on input_from_server: fd != aconnection.sock (PR#4175), Mike Kaufman <=