From 432fe91cbc715b431be7ecad3f0697bce43fb666 Mon Sep 17 00:00:00 2001 From: Elviss Strazdins Date: Thu, 1 Dec 2016 00:06:56 +0200 Subject: [PATCH] Fix reconnect and send timeout --- src/Push.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Push.cpp b/src/Push.cpp index 62cfab7..ad3825f 100644 --- a/src/Push.cpp +++ b/src/Push.cpp @@ -86,6 +86,8 @@ namespace relay connected = false; streamName.clear(); streaming = false; + timeSinceConnect = 0.0f; + timeSinceHandshake = 0.0f; invokeId = 0; invokes.clear(); @@ -103,8 +105,6 @@ namespace relay reset(); active = true; - timeSinceConnect = 0.0f; - if (addresses.empty()) { Log(Log::Level::ERR) << "[" << name << "] " << "No addresses to connect to"; @@ -145,12 +145,12 @@ namespace relay void Push::update(float delta) { - if (active && !socket.isReady()) + if (active) { timeSinceConnect += delta; timeSinceHandshake += delta; - if (timeSinceConnect >= reconnectInterval || + if ((!socket.isReady() && timeSinceConnect >= reconnectInterval) || (state != rtmp::State::HANDSHAKE_DONE && timeSinceHandshake >= reconnectInterval)) { connect();