mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 15:35:50 +00:00
WebSocket ping frequency must be tunable to work around ELB issue.
This commit is contained in:
@@ -61,6 +61,7 @@
|
|||||||
#define SECTION_WEBSOCKET_PUBLIC_IP "websocket_public_ip"
|
#define SECTION_WEBSOCKET_PUBLIC_IP "websocket_public_ip"
|
||||||
#define SECTION_WEBSOCKET_PUBLIC_PORT "websocket_public_port"
|
#define SECTION_WEBSOCKET_PUBLIC_PORT "websocket_public_port"
|
||||||
#define SECTION_WEBSOCKET_PUBLIC_SECURE "websocket_public_secure"
|
#define SECTION_WEBSOCKET_PUBLIC_SECURE "websocket_public_secure"
|
||||||
|
#define SECTION_WEBSOCKET_PING_FREQ "weboscket_ping_frequency"
|
||||||
#define SECTION_WEBSOCKET_IP "websocket_ip"
|
#define SECTION_WEBSOCKET_IP "websocket_ip"
|
||||||
#define SECTION_WEBSOCKET_PORT "websocket_port"
|
#define SECTION_WEBSOCKET_PORT "websocket_port"
|
||||||
#define SECTION_WEBSOCKET_SECURE "websocket_secure"
|
#define SECTION_WEBSOCKET_SECURE "websocket_secure"
|
||||||
@@ -211,6 +212,7 @@ Config::Config()
|
|||||||
WEBSOCKET_PUBLIC_PORT = SYSTEM_WEBSOCKET_PUBLIC_PORT;
|
WEBSOCKET_PUBLIC_PORT = SYSTEM_WEBSOCKET_PUBLIC_PORT;
|
||||||
WEBSOCKET_PUBLIC_SECURE = 1;
|
WEBSOCKET_PUBLIC_SECURE = 1;
|
||||||
WEBSOCKET_SECURE = 0;
|
WEBSOCKET_SECURE = 0;
|
||||||
|
WEBSOCKET_PING_FREQ = (5 * 60);
|
||||||
NUMBER_CONNECTIONS = 30;
|
NUMBER_CONNECTIONS = 30;
|
||||||
|
|
||||||
// a new ledger every minute
|
// a new ledger every minute
|
||||||
@@ -404,6 +406,9 @@ void Config::load()
|
|||||||
if (sectionSingleB(secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp))
|
if (sectionSingleB(secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp))
|
||||||
WEBSOCKET_PUBLIC_SECURE = boost::lexical_cast<int>(strTemp);
|
WEBSOCKET_PUBLIC_SECURE = boost::lexical_cast<int>(strTemp);
|
||||||
|
|
||||||
|
if (sectionSingleB(secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp))
|
||||||
|
WEBSOCKET_PING_FREQ = boost::lexical_cast<int>(strTemp);
|
||||||
|
|
||||||
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
|
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
|
||||||
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
|
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
|
||||||
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
|
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ public:
|
|||||||
int WEBSOCKET_PORT;
|
int WEBSOCKET_PORT;
|
||||||
int WEBSOCKET_SECURE;
|
int WEBSOCKET_SECURE;
|
||||||
|
|
||||||
|
int WEBSOCKET_PING_FREQ;
|
||||||
|
|
||||||
std::string WEBSOCKET_SSL_CERT;
|
std::string WEBSOCKET_SSL_CERT;
|
||||||
std::string WEBSOCKET_SSL_CHAIN;
|
std::string WEBSOCKET_SSL_CHAIN;
|
||||||
std::string WEBSOCKET_SSL_KEY;
|
std::string WEBSOCKET_SSL_KEY;
|
||||||
|
|||||||
@@ -20,10 +20,6 @@
|
|||||||
|
|
||||||
DEFINE_INSTANCE(WebSocketConnection);
|
DEFINE_INSTANCE(WebSocketConnection);
|
||||||
|
|
||||||
#ifndef WEBSOCKET_PING_FREQUENCY
|
|
||||||
#define WEBSOCKET_PING_FREQUENCY (5*60)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename endpoint_type>
|
template <typename endpoint_type>
|
||||||
class WSServerHandler;
|
class WSServerHandler;
|
||||||
//
|
//
|
||||||
@@ -210,7 +206,7 @@ public:
|
|||||||
connection_ptr ptr = mConnection.lock();
|
connection_ptr ptr = mConnection.lock();
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
mPingTimer.expires_from_now(boost::posix_time::seconds(WEBSOCKET_PING_FREQUENCY));
|
mPingTimer.expires_from_now(boost::posix_time::seconds(theConfig.WEBSOCKET_PING_FREQ));
|
||||||
mPingTimer.async_wait(ptr->get_strand().wrap(boost::bind(
|
mPingTimer.async_wait(ptr->get_strand().wrap(boost::bind(
|
||||||
&WSConnection<endpoint_type>::pingTimer, mConnection, mHandler, boost::asio::placeholders::error)));
|
&WSConnection<endpoint_type>::pingTimer, mConnection, mHandler, boost::asio::placeholders::error)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user