Noble Connect
Add relays and punchthrough to Mirror or UNet
NobleConnect.RoundTripTimeout Class Reference

Keeps track of a dynamic round-trip timeout that determines how long to wait before resending messages that expect a response More...

Public Member Functions

 RoundTripTimeout (int initialTimeout=500)
 
void ReceivedResponse (int roundTripTime)
 Call this when a response is received to update the round trip timeout More...
 
void ResendingFailedRequest ()
 

Properties

int Timeout [get]
 Current timeout in milliseconds More...
 

Detailed Description

Keeps track of a dynamic round-trip timeout that determines how long to wait before resending messages that expect a response

Conforms to RFC 2988 with the exceptions defined in RFC 5389 Section 7.2.1

Timeout is stored in milliseconds

Constructor & Destructor Documentation

◆ RoundTripTimeout()

NobleConnect.RoundTripTimeout.RoundTripTimeout ( int  initialTimeout = 500)

Member Function Documentation

◆ ReceivedResponse()

void NobleConnect.RoundTripTimeout.ReceivedResponse ( int  roundTripTime)

Call this when a response is received to update the round trip timeout

Note that this should not be called when a response to a re-transmitted message is received as there is no way to know whether it was a response to the original request or the re-transmission, so the roundTripTime can not be reliably calculated.

Not updating the timeout when receiving a response to a re-transmitted message apparently comes from Karn's algorithm which is all the way from 1987. That's almost as old as me. Neat.

I wish I could get an algorithm named after myself for the idea of sometimes not calling a method...such a simpler time.

Parameters
roundTripTime

◆ ResendingFailedRequest()

void NobleConnect.RoundTripTimeout.ResendingFailedRequest ( )

Property Documentation

◆ Timeout

int NobleConnect.RoundTripTimeout.Timeout
get

Current timeout in milliseconds