tftpy
                                
                                 tftpy copied to clipboard
                                
                                    tftpy copied to clipboard
                            
                            
                            
                        shouldn't use select() with blocking sockets
Currently we use a select loop and blocking sockets, which is actually not a good combination. There are many reasons why select can return, and sometimes they result in a blocking read() operation, which would block the entire server.
Scheduling for 1.0.
Sorry, but would this issue be resolved with this small change?
--- a/tftpy/TftpServer.py
+++ b/tftpy/TftpServer.py
@@ -71,9 +71,9 @@ class TftpServer(TftpSession):
         log.info("Server requested on ip %s, port %s"
                 % (listenip, listenport))
         try:
-            # FIXME - sockets should be non-blocking
             self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
             self.sock.bind((listenip, listenport))
+            self.sock.setblocking(0)
             _, self.listenport = self.sock.getsockname()
         except socket.error, err:
             # Reraise it for now.
Setting the socket non-blocking would fix the select() problem but I'll need to ensure that we're reading from the socket properly in non-blocking mode.