Files
Hippolyzer/pyogp/lib/base/message/packet.py
tao.takashi 6a6dd5fdb1 The big message system renaming:
- renamed all files starting with message_ to a name without message_
- exception: msgdict as dict is a reserved word
- moved all tests into the message/ directory
- changed all tests to use the new names
- changed all modules to use the new names
- shortened imports to not use the full path (pyogp.lib.base. but only the short path)
- removed makepacketdict.py as it's not needed anymore
- moved the data/ directory into message/ as it's local to the msg system

and some small cleanups on the way.

please run the tests!

I haven't adjusted pyogp.interop yet, Enus wanted to look after it.
2008-09-03 22:55:07 +00:00

31 lines
902 B
Python

import grokcore.component as grok
from types import PackFlags
from interfaces import IUDPPacket, IMessageData
class UDPPacket(grok.Adapter):
grok.implements(IUDPPacket)
grok.context(IMessageData)
def __init__(self, context):
self.name = context.name
self.send_flags = PackFlags.LL_NONE
self.packet_id = 0 #aka, sequence number
self.message_data = context
self.acks = [] #may change
self.num_acks = 0
self.trusted = False
self.reliable = False
self.resent = False
self.socket = 0
self.retries = 1 #by default
self.host = None
self.expiration_time = 0
def add_ack(self, packet_id):
self.acks.append(packet_id)
self.num_acks += 1