>> Your implementation has a race condition in it. If two threads run at the 
>> same time and get the same port from “find_free_port” one of your nc calls 
>> will fail.

Hmmm.  I’ll have to think on that.  Kinda hard to avoid because I need to know 
the port number so I can feed it back to the client, and so I can tell the 
netcat process which port to start on. And it is possible that the port number 
might be grabbed by a subsequent request.  Maybe I can do something hacky like 
keep track of recently allocated port numbers for a few seconds to give the 
netcat process time to start on that port.

>> Also why are you not using the subprocess module?

Because I want the netcat processes to be entirely independent of the Python 
server that spawns them, so I do a double fork.

_______________________________________________
melbourne-pug mailing list
melbourne-pug@python.org
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to