MCPcopy Create free account
hub / github.com/LabPy/lantz / forksession

Method forksession

lantz/drivers/legacy/rpc.py:736–756  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

734 self.forksession(self.sock.accept())
735
736 def forksession(self, connection):
737 # Like session but forks off a subprocess
738 import os
739 # Wait for deceased children
740 try:
741 while 1:
742 pid, sts = os.waitpid(0, 1)
743 except os.error:
744 pass
745 pid = None
746 try:
747 pid = os.fork()
748 if pid: # Parent
749 connection[0].close()
750 return
751 # Child
752 self.session(connection)
753 finally:
754 # Make sure we don't fall through in the parent
755 if pid == 0:
756 os._exit(0)
757
758
759class UDPServer(Server):

Callers 1

forkingloopMethod · 0.95

Calls 2

sessionMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected