Skip to content

Commit

Permalink
Fix reconnect and send timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
elnormous committed Nov 30, 2016
1 parent eac91ca commit 432fe91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Push.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ namespace relay
connected = false;
streamName.clear();
streaming = false;
timeSinceConnect = 0.0f;
timeSinceHandshake = 0.0f;
invokeId = 0;
invokes.clear();

Expand All @@ -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";
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 432fe91

Please sign in to comment.