[ENet-discuss] Meaning of timeout limits

Lee Salzman lsalzman1 at cox.net
Tue Mar 28 12:42:55 PST 2006


I recommend against doing that. The better way is to use the keep-alive 
feature of enet_host_service() by passing in a NULL event, i.e.

	enet_host_service(host, NULL, 0);

That will basically handle any pinging that needs to happen and store up 
events that can be dealt with later. Either call this in the middle of 
processing somewhere or set up some sort of alarm handler to call it 
during processing, or some combination of the two.

The way we do it in Sauerbraten is just have the alarm handler set a 
flag. When the flag is set, the keep-alive call is done in the middle of 
the processing and the flag reset.

Lee

Paul Du Bois wrote:
> In development versions of our program, peers may have to pause for
> relatively large amounts of time to perform data processing -- say, up
> to 10 seconds. During this time enet's not being serviced, so remote
> peers disconnect.
> 
> I'd like to increase some of the timeouts to keep this from happening;
> I see these in enet.h:
> 
>    ENET_PEER_TIMEOUT_LIMIT                = 32,
>    ENET_PEER_TIMEOUT_MINIMUM              = 3000,
>    ENET_PEER_TIMEOUT_MAXIMUM              = 30000,
> 
> These must be in milliseconds, I suppose. Reading the code, I _think_
> the right thing to do is bump up the minimum timeout to eg 10000; but
> I'm not sure how that will interact with TIMEOUT_LIMIT (a
> multiplier?). Any advice here?
> 
> thanks!
> p
> 



More information about the ENet-discuss mailing list