mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 21:15:58 +00:00
For now, don't enforce ping timeouts. Just sending the pings is sufficient
to cause dead connections to break.
This commit is contained in:
@@ -142,16 +142,18 @@ public:
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool onPingTimer()
|
bool onPingTimer(std::string&)
|
||||||
{
|
{
|
||||||
|
#ifdef DISCONNECT_ON_WEBSOCKET_PING_TIMEOUTS
|
||||||
if (mPinged)
|
if (mPinged)
|
||||||
return true; // causes connection to close
|
return true; // causes connection to close
|
||||||
|
#endif
|
||||||
mPinged = true;
|
mPinged = true;
|
||||||
setPingTimer();
|
setPingTimer();
|
||||||
return false; // causes ping to be sent
|
return false; // causes ping to be sent
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPong()
|
void onPong(const std::string&)
|
||||||
{
|
{
|
||||||
mPinged = false;
|
mPinged = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,15 +94,14 @@ public:
|
|||||||
return;
|
return;
|
||||||
ptr = it->second;
|
ptr = it->second;
|
||||||
}
|
}
|
||||||
if (ptr->onPingTimer())
|
std::string data("ping");
|
||||||
|
if (ptr->onPingTimer(data))
|
||||||
{
|
{
|
||||||
cLog(lsWARNING) << "Connection pings out";
|
cLog(lsWARNING) << "Connection pings out";
|
||||||
cpClient->close(websocketpp::close::status::PROTOCOL_ERROR, "ping timeout");
|
cpClient->close(websocketpp::close::status::PROTOCOL_ERROR, "ping timeout");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
cpClient->ping(data);
|
||||||
cpClient->ping("ping");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_send_empty(connection_ptr cpClient)
|
void on_send_empty(connection_ptr cpClient)
|
||||||
@@ -126,7 +125,7 @@ public:
|
|||||||
mMap[cpClient] = boost::make_shared< WSConnection<endpoint_type> >(this, cpClient);
|
mMap[cpClient] = boost::make_shared< WSConnection<endpoint_type> >(this, cpClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_pong(connection_ptr cpClient, std::string)
|
void on_pong(connection_ptr cpClient, std::string data)
|
||||||
{
|
{
|
||||||
wsc_ptr ptr;
|
wsc_ptr ptr;
|
||||||
{
|
{
|
||||||
@@ -136,7 +135,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
ptr = it->second;
|
ptr = it->second;
|
||||||
}
|
}
|
||||||
ptr->onPong();
|
ptr->onPong(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_close(connection_ptr cpClient)
|
void on_close(connection_ptr cpClient)
|
||||||
|
|||||||
Reference in New Issue
Block a user