我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用twisted.internet.reactor.removeReader()。
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)
def connectionLost(self, reason): reactor.removeReader(self)
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)