def __init__(self, remote_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(remote_address=remote_address, loss_probability=loss_probability) # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start()
def __init__(self, local_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(local_address=local_address, loss_probability=loss_probability) # Received data waiting for application to consume self._ready_data = queue.Queue() # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start()
def __init__(self, remote_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(remote_address=remote_address, loss_probability=loss_probability) # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start() self._sequence_number = 0 self._semaphore = threading.Semaphore(self._SEND_WINDOW_SIZE) self._timers = dict() self._buffer = dict()
def __init__(self, remote_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(remote_address=remote_address, loss_probability=loss_probability) # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start() # TODO: Add additional state variables self.Buffer = {} self.Timers = {} self.LAST_ACK = 0 self.LAST_SENT = 0 self.sem = threading.Semaphore(self._SEND_WINDOW_SIZE)
def __init__(self, local_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(local_address=local_address, loss_probability=loss_probability) # Received data waiting for application to consume self._ready_data = queue.Queue() self._SEQ_LOCK = threading.Semaphore() self._RECV_LOCK = threading.Semaphore() self._RECV_BUFF_LOCK = threading.Semaphore() self._WINDOW_LOCK = threading.Semaphore(value=self._RECV_WINDOW_SIZE) # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start()
def __init__(self, remote_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(remote_address=remote_address, loss_probability=loss_probability) _timers = {} # A variety of locks and semaphores for maintaining window size, and # packet ordering self._WINDOW_LOCK = threading.BoundedSemaphore( value=self._SEND_WINDOW_SIZE) self._BUFF_LOCK = threading.Semaphore() self._SEQ_NUM_LOCK = threading.Semaphore() self._TIMER_LOCK = threading.Semaphore() # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start()
def __init__(self, remote_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(remote_address=remote_address, loss_probability=loss_probability) # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start() # Additional state variables self.lastACKrcvd = 0 self.sequence_num = 1 self.buffer = [None] * SWPSender._SEND_WINDOW_SIZE self.semaphore = threading.BoundedSemaphore( value=SWPSender._SEND_WINDOW_SIZE) self.mutex = threading.BoundedSemaphore(value=1)
def __init__(self, local_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(local_address=local_address, loss_probability=loss_probability) # Received data waiting for application to consume self._ready_data = queue.Queue() # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start() # Additional state variables self.LastFrameRead = 0 self.buffer = [None] * SWPReceiver._RECV_WINDOW_SIZE self.mutex = threading.BoundedSemaphore(value=1)
def __init__(self, local_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(local_address=local_address, loss_probability=loss_probability) # Received data waiting for application to consume self._ready_data = queue.Queue() # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start() # next frame(packet) expected self.NFE = 0 # possible "hole" packets in the queue to be acked self.recvQ = [None] * 5 self.sema = threading.BoundedSemaphore(value=self._RECV_WINDOW_SIZE)
def __init__(self, remote_address, loss_probability=0): self._llp_endpoint = llp.LLPEndpoint(remote_address=remote_address, loss_probability=loss_probability) # Start receive thread self._recv_thread = threading.Thread(target=self._recv) self._recv_thread.start() self.sema = threading.BoundedSemaphore(value=self._SEND_WINDOW_SIZE) # last acked received self.LAR = 0 # last frame sent self.LFS = 0 # outstanding packets self.sendQ = [None] * 5 # mapping: key-packet, value-time self.timing = {} self.lock = RLock()