Here's another patch.  This one fixes a problem with microsoft windows
non-blocking connnections.   The problem is that on windows, if the
connection is refused, we never see an ECONNREFUSED.  Instead, it
transitions from WSAEINVAL (which acts like EALREADY) back to
EWOULDBLOCK as it tries to make the connection for a second time.

This patch is just a err... patch.  I don't really care for all the
state logic embedded in the exception handler.  My preference would be
to extract out a state machine.  The question is where to put it?  The
safe_connect function operates on a socket argument, so it shouldn't
be in the function.  The best place would be in the socket itself.
That seems like the right place, but it's non-trivial as it would
require subclassing the sockets.

-- Steve


On Sun, Mar 15, 2009 at 4:53 PM, Steve wrote:
> I figured out how to use mercurial patch queues to make keeping all
> this straight on my end.  Attached patches fix the following issues:
>
> 1_selector_deregister_doc_fix - This patch corrects the Selector.py
> docstring to reflect the correct removeReader and friends API.  Minor
> consistency change for newReader and friends as well.
>
> 2_udpng_shutdown_cleanup - This patch builds upon the previous one by
> fixing UDP_ng clients so that they correctly deregister with the
> selector and close their socket upon shutdown.
>
> 3_udpng_safe_bind - This patch puts some basic exception handling
> around the port binding operation.  The clients are updated to check
> for binding success.  This patch prevents unhandled exceptions when
> trying to bind to a port already in use by something else.
>
> tcpclient_delay_micro_optimize - This patch is not dependent on any
> others.  It micro-optimizes some delay calculations to move a math
> operation out of the loop.
>
> tcpserver_safe_bind - This patch is not dependent on any others.  It
> modifies the TCPServer to catch exceptions related to trying to bind
> to a port already in use by something else.
>
> Cheers,
> Steve

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"kamaelia" group.
To post to this group, send email to kamaelia@googlegroups.com
To unsubscribe from this group, send email to 
kamaelia+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/kamaelia?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: tcpclient_msw_conrefused_fix.patch
Description: Binary data

Reply via email to