Browse Source

revert to rev 49fe188132 and pass reuse_addr==false to CTOR of _acceptor

tags/Release_2.1.0-RC3
Jorg Knobloch 3 months ago
parent
commit
5d24310148
1 changed files with 1 additions and 13 deletions
  1. +1
    -13
      webserver.cc

+ 1
- 13
webserver.cc View File

@@ -14,7 +14,7 @@ namespace fs = boost::filesystem;
namespace pEp {
Webserver::Webserver(net::ip::address addr, unsigned short port, const std::string& doc_root)
: _ioc{1}
, _acceptor{_ioc, {addr, port}}
, _acceptor{_ioc, {addr, port}, false}
, _doc_root{doc_root}
, _generic_handler{}
, _port{port}
@@ -231,21 +231,9 @@ the_end:

void Webserver::runner(Webserver *me)
{
boost::asio::socket_base::keep_alive keep_alive(true);
boost::asio::socket_base::reuse_address reuse_address(false);

while (me->_running)
{
tcp::socket* socket = new tcp::socket{me->_ioc};
me->_acceptor.set_option(keep_alive);
me->_acceptor.set_option(reuse_address);

#ifdef WiN32
int fd = me->_acceptor.native_handle();
BOOL value = 1;
setsockopt(fd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, &value, sizeof(BOOL));
#endif

me->_acceptor.accept(*socket);

std::function< void() > tf = [=]()


Loading…
Cancel
Save