本文整理匯總了Python中Event.eventTimeoutDelete方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.eventTimeoutDelete方法的具體用法?Python Event.eventTimeoutDelete怎麽用?Python Event.eventTimeoutDelete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Event
的用法示例。
在下文中一共展示了Event.eventTimeoutDelete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __handleTimeoutFIN
# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeoutDelete [as 別名]
def __handleTimeoutFIN(self, packetSequenceNumber):
logger.log(Level.DEBUG, "Handling FIN timeout of:" + str(packetSequenceNumber))
if self.__incrementRetries():
Event.eventTimeoutDelete(self.__handleTimeoutFIN, packetSequenceNumber)
packet = RudpPacket()
packet.type = RudpPacket.TYPE_FIN
packet.seqnum = packetSequenceNumber
self.rudpSocket.sendPacketControl(self.addr, packet)
Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutFIN, packet.seqnum, "DATA Timeout")
示例2: __handleTimeoutSYN
# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeoutDelete [as 別名]
def __handleTimeoutSYN(self, packetSequenceNumber):
logger.log(Level.DEBUG, "Handling SYN timeout of:" + str(packetSequenceNumber))
Event.eventTimeoutDelete(self.__handleTimeoutSYN, packetSequenceNumber)
if self.__incrementRetries():
packet = self.rudpSocket.generateSynPacket()
self.nextAckSeqNumber = packet.seqnum + 1
logger.log(Level.INFO, "Retransmitting SYN")
self.rudpSocket.sendPacketControl(self.addr, packet)
Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutSYN, packet.seqnum, "SYN timeout")
示例3: __handleTimeoutData
# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeoutDelete [as 別名]
def __handleTimeoutData(self, rudpSecNum):
logger.log(Level.DEBUG, "Handling packet timeout DATA packet seq:" + str(rudpSecNum))
''' Here we need to remove all other DATA packet timeouts'''
for seq in range(rudpSecNum, self.nextSendingPacketSeqNumber):
Event.eventTimeoutDelete(self.__handleTimeoutData, seq)
if self.__incrementRetries():
''' Decrease window size, reset packet index to the one we lost'''
self.window = 1 if self.window - 1 < 1 else self.window - 1
self.nextSendingPacketSeqNumber = rudpSecNum
self.__emptyBuffer()
self.retries = self.retries + 1
示例4: handleACK
# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeoutDelete [as 別名]
def handleACK(self, ackPacket):
if ackPacket.seqnum != self.nextAckSeqNumber:
logger.log(Level.ERROR, "ACK with wrong sequence number, probably arrived too late, ignoring")
return
if self.state == RudpSocket.STATE_INITING:
''' Must be ACK in response to SYN'''
logger.log(Level.DEBUG, "Handling ACK for SYN")
self.state = RudpSocket.STATE_ESTABLISHED
self.nextAckSeqNumber = 1
Event.eventTimeoutDelete(self.__handleTimeoutSYN, ackPacket.seqnum - 1)
self.__emptyBuffer()
self.__resetRetries()
elif self.state == RudpSocket.STATE_ESTABLISHED:
''' Must be ACK in response to DATA'''
logger.log(Level.DEBUG, "Handling ACK for DATA")
logger.log(Level.DEBUG, "ACK CORRECT")
Event.eventTimeoutDelete(self.__handleTimeoutData, ackPacket.seqnum - 1)
self.nextAckSeqNumber = ackPacket.seqnum + 1
self.window = self.window + 1
self.__emptyBuffer()
self.__resetRetries()
self.__checkClose()
elif self.state == RudpSocket.STATE_CLOSED:
''' This must be the final ACK'''
logger.log(Level.DEBUG, "Final ACK received:" + str(self.rudpSocket))
Event.eventTimeoutDelete(self.__handleTimeoutFIN, ackPacket.seqnum - 1)
self.finished = True
self.rudpSocket._peerFinished()