[Vortex] How to correctly close a connection?
Robert M. Münch
robert.muench at robertmuench.de
Mon Oct 6 18:40:30 CEST 2008
Am 06.10.2008, 18:32 Uhr, schrieb Francis Brosnan Blazquez
<francis at aspl.es>:
> This is correct. However, every on going transfer, in both sides, will
> be cancelled.
Hi, ok. But overall the receiver part shouldn't be affected in switch back
to the listening state.
>> 2. I want to make sure that a call to disconnect from the script hangs
>> as long there is still a transfer running on the vortex side. So,
>> blocking
>> the script. How can I check if vortex channels are still in use and wait
>> until I can close a connection gracefully?
>
> It depends on your protocol. Who is going to close the connection, the
> server (frame received) or the client? or both?
The client. But the script on the client is asynchronous as well. So the
client script needs either to poll via a call if a transfer is still
ongoing before calling the close-connection function. The other option (I
prefer) is to make close-connection blocking until all transfers ended.
> This is right. If you receive this notification, then the connection was
> notified to be closed. However, the connection is still accesible until
> all vortex subsystem drop its references to the connection (and those
> ones created by your code).
Ok. The client uses a shutdown call for this. On the receiver side, I do
it by hand because the receiver switches back to listening state to serve
other possible client connections.
> But, it crashes when the connection that was notified to be closed is
> used again? or...?
No, on the server at the moment the client closes the connection.
> If so, the connection must not be used once the handler finishes.
Yes, this is ensured and I don't use it anylonger.
The strange thing is, I only get the crash on Linux. On Windows it works.
Here is the GDB backtrace:
#0 0xb7ebc71c in free () from /lib/tls/i686/cmov/libc.so.6
#1 0xb7d3060d in axl_hash_free (hash=0x3e8bb) at axl_hash.c:1216
#2 0xb7d028f8 in vortex_hash_destroy (hash_table=0x821a908)
at vortex_hash.c:357
#3 0xb7cebdf1 in vortex_connection_free (connection=0x821a598)
at vortex_connection.c:2494
#4 0xb7d00d61 in __vortex_reader_build_set_to_watch_aux (
on_reading=0x814f118, cursor=0x814f840, current_max=10)
at vortex_reader.c:971
#5 0xb7d0200d in __vortex_reader_run (ctx=0x814e108) at
vortex_reader.c:1228
#6 0xb7cc5240 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7 0xb7f2249e in clone () from /lib/tls/i686/cmov/libc.so.6
Any idea?
--
Robert M. Münch
Mobile: +49 (177) 245 2802
http://www.robertmuench.de
More information about the Vortex
mailing list