diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-03-11 19:44:13 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-08-15 18:22:58 +0200 |
| commit | d710869f0a42285e81c72c1e5b9e76886e0d190a (patch) | |
| tree | 2d20b9727c27bb9748d8c2d74625999a30295e52 /src/lib/dcpomatic_socket.cc | |
| parent | bb78e4dcbdf5f9592679f0262b97de240fbd62e7 (diff) | |
Add Socket::set_send_buffer_size().
Diffstat (limited to 'src/lib/dcpomatic_socket.cc')
| -rw-r--r-- | src/lib/dcpomatic_socket.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/dcpomatic_socket.cc b/src/lib/dcpomatic_socket.cc index f4292e842..014e498e6 100644 --- a/src/lib/dcpomatic_socket.cc +++ b/src/lib/dcpomatic_socket.cc @@ -21,6 +21,7 @@ #include "compose.hpp" #include "dcpomatic_assert.h" +#include "dcpomatic_log.h" #include "dcpomatic_socket.h" #include "exceptions.h" #include <boost/bind/bind.hpp> @@ -76,6 +77,16 @@ Socket::connect (boost::asio::ip::tcp::endpoint endpoint) if (!_socket.is_open ()) { throw NetworkError (_("connect timed out")); } + + if (_send_buffer_size) { + boost::asio::socket_base::send_buffer_size old_size; + _socket.get_option(old_size); + + boost::asio::socket_base::send_buffer_size new_size(*_send_buffer_size); + _socket.set_option(new_size); + + LOG_GENERAL("Changed socket send buffer size from %1 to %2", old_size.value(), *_send_buffer_size); + } } @@ -243,3 +254,10 @@ Socket::finish_write_digest () write (buffer, size); } + +void +Socket::set_send_buffer_size (int size) +{ + _send_buffer_size = size; +} + |
