Exemplo n.º 1
0
class _AlienSession:
    def __init__(self, specifier: AlienSessionSpecifier) -> None:
        assert specifier.source_node_id is not None
        self._specifier = specifier
        self._reassembler = AlienTransferReassembler(specifier.source_node_id)

    def update(self, timestamp: Timestamp, frame: UDPFrame) -> typing.Optional[Trace]:
        tid_timeout = self._reassembler.transfer_id_timeout
        tr = self._reassembler.process_frame(timestamp, frame)
        if isinstance(tr, TransferReassembler.Error):
            return UDPErrorTrace(timestamp=timestamp, error=tr)
        if isinstance(tr, TransferFrom):
            meta = AlienTransferMetadata(tr.priority, tr.transfer_id, self._specifier)
            return TransferTrace(timestamp, AlienTransfer(meta, tr.fragmented_payload), tid_timeout)
        assert tr is None
        return None
Exemplo n.º 2
0
 def __init__(self, specifier: AlienSessionSpecifier) -> None:
     assert specifier.source_node_id is not None
     self._specifier = specifier
     self._reassembler = AlienTransferReassembler(specifier.source_node_id)
Exemplo n.º 3
0
 def __init__(self, specifier: AlienSessionSpecifier) -> None:
     self._specifier = specifier
     src = specifier.source_node_id
     self._reassembler = AlienTransferReassembler(
         src) if src is not None else None