def drain( self ):
# Stop accepting new connections.
if self.server is not None:
self.server.close()
# Ask all the clients to nicely disconnect.
for aid, c in self.currentClients.items():
try:
c.sendFrame( HcpModuleId.HCP,
( rSequence().addInt8( Symbols.base.OPERATION,
HcpOperations.DISCONNECT ), ) )
except:
pass
# Wait for everyone to be out.
while 0 != self.nConnected:
self.log( "still %d clients connected" % self.nConnected )
self.sleep( 5 )
评论列表
文章目录