Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Merge branch 'devel' into task/parchard/KEP-1294_devel
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruck committed Mar 27, 2019
2 parents b933243 + 6732214 commit 3bcdadd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions node/node.cpp
Expand Up @@ -94,9 +94,15 @@ node::do_accept()
self->acceptor_socket->get_tcp_socket().set_option(boost::asio::ip::tcp::no_delay(true), option_ec);
if (option_ec)
{
LOG(warning) << "failed to set socket option: " << option_ec.message();
LOG(warning) << "failed to set socket option TCP_NODELAY: " << option_ec.message();
}

#ifndef __APPLE__
int flags = 1;
if (setsockopt(self->acceptor_socket->get_tcp_socket().native_handle(), SOL_TCP, TCP_QUICKACK, &flags, sizeof(flags)))
{
LOG(warning) << "failed to set socket option TCP_QUICKACK: " << errno;
}
#endif
std::shared_ptr<bzn::beast::websocket_stream_base> ws = self->websocket->make_unique_websocket_stream(
self->acceptor_socket->get_tcp_socket());

Expand Down
11 changes: 8 additions & 3 deletions node/session.cpp
Expand Up @@ -17,7 +17,6 @@
#include <sstream>
#include <boost/beast/websocket/error.hpp>


using namespace bzn;

session::session(
Expand Down Expand Up @@ -95,9 +94,15 @@ session::open(std::shared_ptr<bzn::beast::websocket_base> ws_factory)
socket->get_tcp_socket().set_option(boost::asio::ip::tcp::no_delay(true), option_ec);
if (option_ec)
{
LOG(error) << "failed to set socket option: " << option_ec.message();
LOG(warning) << "failed to set socket option TCP_NODELAY: " << option_ec.message();
}

#ifndef __APPLE__
int flags = 1;
if (setsockopt(socket->get_tcp_socket().native_handle(), SOL_TCP, TCP_QUICKACK, &flags, sizeof(flags)))
{
LOG(warning) << "failed to set socket option TCP_QUICKACK: " << errno;
}
#endif
self->websocket = ws_factory->make_unique_websocket_stream(socket->get_tcp_socket());
self->websocket->async_handshake(self->ep.address().to_string(), "/",
self->strand->wrap([self, ws_factory](const boost::system::error_code& ec)
Expand Down

0 comments on commit 3bcdadd

Please sign in to comment.