Here are the examples of the python api twisted.internet.fdesc.setBlocking taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
View Complete Implementation : process.py
Copyright MIT License
Author : wistbean
Copyright MIT License
Author : wistbean
def connectionLost(self, reason):
"""
See abstract.FileDescriptor.connectionLost.
"""
# At least on macOS 10.4, exiting while stdout is non-blocking can
# result in data loss. For some reason putting the file descriptor
# back into blocking mode seems to resolve this issue.
fdesc.setBlocking(self.fd)
abstract.FileDescriptor.connectionLost(self, reason)
self.proc.childConnectionLost(self.name, reason)
0
View Complete Implementation : inetd.py
Copyright MIT License
Author : adde88
Copyright MIT License
Author : adde88
def connectionMade(self):
sockFD = self.transport.fileno()
childFDs = {0: sockFD, 1: sockFD}
if self.factory.stderrFile:
childFDs[2] = self.factory.stderrFile.fileno()
# processes run by inetd expect blocking sockets
# FIXME: maybe this should be done in process.py? are other uses of
# Process possibly affected by this?
fdesc.setBlocking(sockFD)
if childFDs.has_key(2):
fdesc.setBlocking(childFDs[2])
service = self.factory.service
uid = service.user
gid = service.group
# don't tell Process to change our UID/GID if it's what we
# already are
if uid == os.getuid():
uid = None
if gid == os.getgid():
gid = None
process.Process(None, service.program, service.programArgs, os.environ,
None, None, uid, gid, childFDs)
reactor.removeReader(self.transport)
reactor.removeWriter(self.transport)
0
View Complete Implementation : inetd.py
Copyright MIT License
Author : wistbean
Copyright MIT License
Author : wistbean
def connectionMade(self):
sockFD = self.transport.fileno()
childFDs = {0: sockFD, 1: sockFD}
if self.factory.stderrFile:
childFDs[2] = self.factory.stderrFile.fileno()
# processes run by inetd expect blocking sockets
# FIXME: maybe this should be done in process.py? are other uses of
# Process possibly affected by this?
fdesc.setBlocking(sockFD)
if 2 in childFDs:
fdesc.setBlocking(childFDs[2])
service = self.factory.service
uid = service.user
gid = service.group
# don't tell Process to change our UID/GID if it's what we
# already are
if uid == os.getuid():
uid = None
if gid == os.getgid():
gid = None
process.Process(None, service.program, service.programArgs, os.environ,
None, None, uid, gid, childFDs)
reactor.removeReader(self.transport)
reactor.removeWriter(self.transport)