Fix signal_transmit crash (#286)

* Check if fd is in self.rwait

* Check if set is empty
This commit is contained in:
Mark Mossberg 2017-06-07 17:22:37 -04:00 committed by GitHub
parent f3a48f23b8
commit 22bfedf8bb

View File

@ -1590,9 +1590,13 @@ class Linux(Platform):
def signal_transmit(self, fd):
''' Awake one process waiting to transmit data on fd '''
connections = self.connections
if connections(fd) and self.rwait[connections(fd)]:
procid = random.sample(self.rwait[connections(fd)], 1)[0]
connection = self.connections(fd)
if connection is None or connection >= len(self.rwait):
return
procs = self.rwait[connection]
if procs:
procid = random.sample(procs, 1)[0]
self.awake(procid)
def check_timers(self):