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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx, ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] (PR#4175) Core on input_from_server: fd != aconnection.sock
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Thu, 11 Sep 2003 11:47:51 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[ChrisK@xxxxxxxx - Wed Jul 16 10:00:35 2003]:

> On Wed, Jul 16, 2003 at 02:50:02AM -0700, Jason Short wrote:
> > 
> > Yes, I get this as well.  Apparently if you try to connect with the 
> > dialog, you can try again while your first attempt is still in progress.
> > 
> > I have no idea where it came from or how long it's been around...
> 
> This has been introduced lately by the authentification patch. In the test
> phase, there had been more problems like this, but this one's got through.
> 
> See the auth patch discussion for details. See 4175 for the real problem.
> 
> I should have noted, that this was without --enable-auth. Not testet yet
> *with* authentification compiled into the server. But it is a client
problem
> anyway, and the compile option shouldn't matter.

The bug is in this bit in clinet.c:
  if (aconnection.buffer) {
    /* didn't close cleanly previously? */
    freelog(LOG_ERROR, "Unexpected buffers in try_to_connect()");
    /* get newly initialized ones instead */
    free_socket_packet_buffer(aconnection.buffer);
    aconnection.buffer = NULL;
    free_socket_packet_buffer(aconnection.send_buffer);
    aconnection.send_buffer = NULL;
  }
                                                                       
        
The thing is, if you press return continuously, or press it more than
once, the client calls connect_to_server more than once.
The 2nd time it tries to connect it still hasn't managed to establish a
connection to the server, hence it enters the code in that branch.

My solution is to *not* be impacient. If a connection is in progress
just wait.

A patch with a fix is attached. The client/clinet.c changes contain the
bugfix. The rest is cleanup.

Attachment: conncore.diff
Description: conncore.diff


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