fix bug causing server to stop listening

This commit is contained in:
David Rose 2009-11-10 13:17:22 +00:00
parent 0a673d3e8c
commit 29c61ac510

View File

@ -1,7 +1,6 @@
"""ServerRepository module: contains the ServerRepository class""" """ServerRepository module: contains the ServerRepository class"""
from pandac.PandaModules import * from pandac.PandaModules import *
#from TaskManagerGlobal import *
from direct.distributed.MsgTypesCMU import * from direct.distributed.MsgTypesCMU import *
from direct.task import Task from direct.task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
@ -264,7 +263,7 @@ class ServerRepository:
retVal = self.qcl.getNewConnection(rendezvous, netAddress, retVal = self.qcl.getNewConnection(rendezvous, netAddress,
newConnection) newConnection)
if not retVal: if not retVal:
return return task.cont
# Crazy dereferencing # Crazy dereferencing
newConnection=newConnection.p() newConnection=newConnection.p()
@ -284,13 +283,13 @@ class ServerRepository:
self.lastConnection = newConnection self.lastConnection = newConnection
self.sendDoIdRange(client) self.sendDoIdRange(client)
return Task.cont return task.cont
def readerPollUntilEmpty(self, task): def readerPollUntilEmpty(self, task):
""" continuously polls for new messages on the server """ """ continuously polls for new messages on the server """
while self.readerPollOnce(): while self.readerPollOnce():
pass pass
return Task.cont return task.cont
def readerPollOnce(self): def readerPollOnce(self):
""" checks for available messages to the server """ """ checks for available messages to the server """
@ -652,7 +651,7 @@ class ServerRepository:
for client in self.clientsByConnection.values(): for client in self.clientsByConnection.values():
if not self.qcr.isConnectionOk(client.connection): if not self.qcr.isConnectionOk(client.connection):
self.handleClientDisconnect(client) self.handleClientDisconnect(client)
return Task.cont return task.cont
def sendToZoneExcept(self, zoneId, datagram, exceptionList): def sendToZoneExcept(self, zoneId, datagram, exceptionList):
"""sends a message to everyone who has interest in the """sends a message to everyone who has interest in the