Make sure we don't use the jitter / delay in production builds.

And default to 0 even for debug; who wants to use that for debugging, they
know what to do.

Change-Id: I23dd0c5f806b2b31a883b7a2b8d822ea8c0bb6c5
This commit is contained in:
Jan Holesovsky 2016-11-28 11:26:41 +01:00
parent 752372a2b0
commit 9842f3239f

View file

@ -31,11 +31,11 @@ class LOOLWebSocket : public Poco::Net::WebSocket
private:
std::mutex _mutex;
#ifdef ENABLE_DEBUG
#if ENABLE_DEBUG
std::chrono::milliseconds getWebSocketDelay()
{
unsigned long baseDelay = WS_DELAY_MS;
unsigned long jitter = WS_JITTER_MS;
unsigned long baseDelay = 0;
unsigned long jitter = 0;
if (std::getenv("LOOL_WS_DELAY"))
{
baseDelay = std::stoul(std::getenv("LOOL_WS_DELAY"));
@ -81,7 +81,7 @@ public:
/// Should we also factor out the handling of non-final and continuation frames into this?
int receiveFrame(char* buffer, const int length, int& flags)
{
#ifdef ENABLE_DEBUG
#if ENABLE_DEBUG
// Delay receiving the frame
std::this_thread::sleep_for(getWebSocketDelay());
#endif
@ -111,7 +111,7 @@ public:
/// Wrapper for Poco::Net::WebSocket::sendFrame() that handles large frames.
int sendFrame(const char* buffer, const int length, const int flags = FRAME_TEXT)
{
#ifdef ENABLE_DEBUG
#if ENABLE_DEBUG
// Delay sending the frame
std::this_thread::sleep_for(getWebSocketDelay());
#endif