[Verse-dev] connection bugs

Brecht Van Lommel blendix at pandora.be
Tue Oct 12 03:07:07 CEST 2004


Hi

I found a few bugs:

- verse_send_connect often returns NULL, even if it succeeds. The cause
is in v_connection.c ~line 105:

VConData.current_connection = VConData.con_count;
++VConData.con_count;
return VConData.con[VConData.con_count].out_queue;

The wrong queue is being returned. Changing the last line to this, fixed
it for me:

return VConData.con[VConData.current_connection].out_queue;

- the server can crash if the connection gets aborted in the 'contact
phase'. What happens is that the connection times out, and in
v_connection.c, ~line 272:

if(v_niq_time_out(&VConData.con[VConData.current_connection].in_queue))
	v_callback_connect_terminate("connection timed out");

This results in the server trying to send a connect_terminated command
to the client. But when it requests the avatar with vs_get_avatar(), the
server hasn't stored this info yet, and crashes.

I'm not sure what the best solution is. I came up with this, and it
works for me, but I don't have a good overview of the surrounding code.
This replaces code in v_connection.c, ~line 272.

if(v_niq_time_out(&VConData.con[VConData.current_connection].in_queue))
{
    if(v_con_get_connect_stage() > V_CS_PENDING_ACCEPT)
        v_callback_connect_terminate("connection timed out");
    else
        verse_session_destroy(VConData.con[VConData.current_connection]
        .out_queue);
}

- A new inconvenience in r4 (not really a bug) is that i can't have a
client quickly reconnect to a server, when the previous client hasn't
sent cleanly terminated the connection. What happens is that the
connection hasn't timed out yet, but the new client gets the same
ip/port assigned. The server then refuses to connect, until the 20s
timeout time has passed.

I lowered the 20s to 3s in my cvs checkout, so I doesn't bother me
anymore. But it's not very nice behavior. I don't have a solution
though. Maybe the client could somehow get a random port, or the server
could kindly tell the client to get another port?

Cheers,
Brecht.



More information about the Verse-dev mailing list