En Thu, 06 Dec 2007 13:11:09 -0300, Bret <[EMAIL PROTECTED]> escribió:

> For completeness, what I ended up doing is this:
>
>     server = SimpleXMLRPCServer((host, port))
>     server.socket.settimeout(0.1)
>
> ServerWrapper became:
>
>     def ServerWrapper():
>         while True:
>             try:
>                 server.handle_request()
>                 if self.done.isSet():
>                     break
>             except timeout:
>                 pass
>
> And that seems to do the trick!  Giving the socket a timeout allows me
> to check the Event more frequently and catch the change within a
> reasonable time.

Remember that the timeout applies to *all* socket operations; what if the  
XML request requires more than 0.1s to read?
If handling large requests is more important than the delay at shutdown  
time, consider raising that value.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to