From 40341d16fb0625514caa0f853d63c502c263c267 Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Wed, 29 Apr 2015 14:46:44 +0200 Subject: [PATCH] Correct NetJack2 time out handling. --- common/JackNetAPI.cpp | 4 ++-- common/JackNetInterface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/JackNetAPI.cpp b/common/JackNetAPI.cpp index 573a7023..85cb52bd 100644 --- a/common/JackNetAPI.cpp +++ b/common/JackNetAPI.cpp @@ -863,9 +863,9 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf // One cycle Process(); - + // Then use PACKET_TIMEOUT * fParams.fNetworkLatency for next cycles - SetPacketTimeOut(PACKET_TIMEOUT * fParams.fNetworkLatency); + SetPacketTimeOut(std::max(int(PACKET_TIMEOUT), int(PACKET_TIMEOUT * fParams.fNetworkLatency))); } int Process() diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index 8f2b479e..dce0f19e 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -36,7 +36,7 @@ namespace Jack #define MANAGER_INIT_TIMEOUT 1000000 * 2 // in usec #define MASTER_INIT_TIMEOUT 1000000 * 10 // in usec #define SLAVE_INIT_TIMEOUT 1000000 * 1 // in usec -#define PACKET_TIMEOUT 500000 // in usec +#define PACKET_TIMEOUT 1000000 // in usec #define NETWORK_DEFAULT_LATENCY 2 #define NETWORK_MAX_LATENCY 30 // maximum possible latency in network master/slave loop