public SentRequest(DrpPeerEngine engine, Logger logger, IPEndPoint destinationEndpoint, ConnectionToNeighbor destinationNeighborNullable, byte[] requestUdpData, RequestP2pSequenceNumber16 sentReqP2pSeq16, LowLevelUdpResponseScanner ack1Scanner) { _destinationEndpoint = destinationEndpoint; _logger = logger; _requestUdpData = requestUdpData; _sentReqP2pSeq16 = sentReqP2pSeq16; _ack1Scanner = ack1Scanner; _destinationNeighborNullable = destinationNeighborNullable; _engine = engine; }
public PendingLowLevelUdpRequest(string completionActionVisibleId, IPEndPoint responderEndpoint, LowLevelUdpResponseScanner responseScanner, DateTime timeUtc, double expirationTimeoutS, byte[] requestPacketDataNullable = null, double?initialRetransmissionTimeoutS = null, double?retransmissionTimeoutIncrement = null) { CompletionActionVisibleId = completionActionVisibleId; _retransmissionTimeoutIncrement = retransmissionTimeoutIncrement; ExpirationTimeUTC = timeUtc.AddSeconds(expirationTimeoutS); _currentRetransmissionTimeoutS = initialRetransmissionTimeoutS; if (_currentRetransmissionTimeoutS.HasValue) { NextRetransmissionTimeUTC = timeUtc.AddSeconds(_currentRetransmissionTimeoutS.Value); } ResponderEndpoint = responderEndpoint; ResponseScanner = responseScanner; RequestPacketDataNullable = requestPacketDataNullable; _expirationTimeoutS = expirationTimeoutS; }
internal async Task <byte[]> OptionallySendUdpRequestAsync_Retransmit_WaitForResponse(string completionActionVisibleId, string responderVisibleDescription, byte[] requestPacketDataNullable, IPEndPoint responderEndpoint, LowLevelUdpResponseScanner responseScanner, double?expirationTimeoutS = null) { var timeoutS = expirationTimeoutS ?? Configuration.UdpLowLevelRequests_ExpirationTimeoutS; var pendingLowLevelUdpRequest = new PendingLowLevelUdpRequest(completionActionVisibleId, responderEndpoint, responseScanner, DateTimeNowUtc, timeoutS, requestPacketDataNullable, Configuration.UdpLowLevelRequests_InitialRetransmissionTimeoutS, Configuration.UdpLowLevelRequests_RetransmissionTimeoutIncrement ); var nextHopResponsePacketData = await SendUdpRequestAsync_Retransmit(pendingLowLevelUdpRequest); if (nextHopResponsePacketData == null) { string desc = $"no response to DRP request from '{responderVisibleDescription}' '"; if (requestPacketDataNullable != null) { desc += (PacketTypes)requestPacketDataNullable[0]; } desc += $"' - timeout expired ({timeoutS}s) completionAction={completionActionVisibleId}"; throw new DrpTimeoutException(desc); } return(nextHopResponsePacketData); }