Skip to content

Commit

Permalink
Merge pull request #1849 from skalenetwork/bug/1774-change-zmq-broadc…
Browse files Browse the repository at this point in the history
…ast-hwm

#1774 change hwm limits for zmq broadcast
  • Loading branch information
olehnikolaiev authored Mar 14, 2024
2 parents d05e981 + bf14d01 commit 5452ee7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions libskale/broadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ void* ZmqBroadcaster::server_socket() const {
val = 60000;
zmq_setsockopt( m_zmq_server_socket, ZMQ_HEARTBEAT_TTL, &val, sizeof( val ) );


val = 16;
zmq_setsockopt( m_zmq_server_socket, ZMQ_RCVHWM, &val, sizeof( val ) );
val = 16;
// remove limits to prevent txns from being dropped out
val = 0;
zmq_setsockopt( m_zmq_server_socket, ZMQ_SNDHWM, &val, sizeof( val ) );


Expand Down Expand Up @@ -134,11 +132,8 @@ void* ZmqBroadcaster::client_socket() const {
value = 300;
zmq_setsockopt( m_zmq_client_socket, ZMQ_TCP_KEEPALIVE_INTVL, &value, sizeof( value ) );

value = 16;
value = 0;
zmq_setsockopt( m_zmq_client_socket, ZMQ_RCVHWM, &value, sizeof( value ) );
value = 16;
zmq_setsockopt( m_zmq_client_socket, ZMQ_SNDHWM, &value, sizeof( value ) );


const dev::eth::ChainParams& ch = m_client.chainParams();

Expand Down Expand Up @@ -254,6 +249,8 @@ void ZmqBroadcaster::broadcast( const std::string& _rlp ) {

int res = zmq_send( server_socket(), const_cast< char* >( _rlp.c_str() ), _rlp.size(), 0 );
if ( res <= 0 ) {
clog( dev::VerbosityWarning, "zmq-broadcaster" )
<< "Got error " << res << " in zmq_send: " << zmq_strerror( res );
throw std::runtime_error( "Zmq can't send data" );
}
}

0 comments on commit 5452ee7

Please sign in to comment.