An individual UDP datagram.
| 6 | |
| 7 | |
| 8 | class UDPMessage(serializable.Serializable): |
| 9 | """ |
| 10 | An individual UDP datagram. |
| 11 | """ |
| 12 | |
| 13 | def __init__(self, from_client, content, timestamp=None): |
| 14 | self.from_client = from_client |
| 15 | self.content = content |
| 16 | self.timestamp = timestamp or time.time() |
| 17 | |
| 18 | @classmethod |
| 19 | def from_state(cls, state): |
| 20 | return cls(*state) |
| 21 | |
| 22 | def get_state(self): |
| 23 | return self.from_client, self.content, self.timestamp |
| 24 | |
| 25 | def set_state(self, state): |
| 26 | self.from_client, self.content, self.timestamp = state |
| 27 | |
| 28 | def __repr__(self): |
| 29 | return "{direction} {content}".format( |
| 30 | direction="->" if self.from_client else "<-", content=repr(self.content) |
| 31 | ) |
| 32 | |
| 33 | |
| 34 | class UDPFlow(flow.Flow): |
no outgoing calls
searching dependent graphs…