[DGD] Changing connect() (network package)
bart at wotf.org
bart at wotf.org
Sun Dec 9 17:00:58 CET 2007
As mentioned in my previous mails, I've been changing the network package to
make calls to connect() non blocking.
I got it to work as I want, that is, connections are made without freezing the
mud untill the initial 3 way handshake is complete, and the calling of open()
is delayed untill the connection has been made, and is not called at all when
no connection could be made. Also, conn_read and conn_write have been changed
to not error on connections that are awaiting completion of the initial handshake.
When the connection fails, I want to report that back to the object that
called connect() by means of a callback. I see a few ways of doing this:
1. Call receive_message() with an appropriate string (strerror or alternative)
and let the object figure out it was an error from the fact that open() was
never called and hence there was no connection to receive data from.
2. Call an alternative function, ie: receive_error() with the failure message.
3. Call open() with an argument to indicate the failure.
I don't like 3 really, but unsettled on 1 and 2. I'm using option 2 for
testing the code and this seems to work well.
Any opinions on this? Or for that matter, anyone else interested in this?
Bart.
ps: testing and debugging it still, when satisfied I'll make this patch available.
--
Created with Open WebMail at http://www.bartsplace.net/
Read my weblog at http://soapbox.bartsplace.net/
More information about the DGD
mailing list