diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-21 15:22:48 +0100 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-21 15:22:48 +0100 |
| commit | 37315f877ef27d0f8585389f0c83cd00a31577c1 (patch) | |
| tree | caead8a996811c154859d97ae3c5c946ae8da4b6 /libcmix-network | |
| parent | e4cf0d04c4afff98603df440d12a4a19b3717a34 (diff) | |
| download | cmix-37315f877ef27d0f8585389f0c83cd00a31577c1.tar.gz cmix-37315f877ef27d0f8585389f0c83cd00a31577c1.tar.bz2 cmix-37315f877ef27d0f8585389f0c83cd00a31577c1.zip | |
Reworked server and client to do one mix and shutdown.
This is done as cleanly as possible to track down any memory leaks.
unfortunately there is still one async operation running on the nodes.
when there should be none. So the nodes are still forced to stop with a.
io_service.stop().
Diffstat (limited to 'libcmix-network')
| -rw-r--r-- | libcmix-network/acceptor.cpp | 3 | ||||
| -rw-r--r-- | libcmix-network/client.hpp | 5 | ||||
| -rw-r--r-- | libcmix-network/server.cpp | 8 |
3 files changed, 11 insertions, 5 deletions
diff --git a/libcmix-network/acceptor.cpp b/libcmix-network/acceptor.cpp index ee8833a..02a0541 100644 --- a/libcmix-network/acceptor.cpp +++ b/libcmix-network/acceptor.cpp @@ -56,5 +56,6 @@ void Acceptor::start_accepting(std::shared_ptr<ssl::context> ctx, SSLAcceptHandl void Acceptor::close() { - acceptor.close(); + acceptor.get_io_service().post([this]{acceptor.cancel();}); + acceptor.get_io_service().post([this]{acceptor.close();}); } diff --git a/libcmix-network/client.hpp b/libcmix-network/client.hpp index c583628..b43f32b 100644 --- a/libcmix-network/client.hpp +++ b/libcmix-network/client.hpp @@ -189,7 +189,7 @@ public: * \brief close Closes the underlying socket. */ void close() { - socket->close(); + socket->next_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_type::shutdown_both); } /*! @@ -268,7 +268,8 @@ struct SSLClient : private BaseClient<boost::asio::ssl::stream<boost::asio::ip:: * \brief close Closes the underlying socket. */ void close() { - socket->lowest_layer().cancel(); + socket->shutdown(); + BaseClient::close(); } using BaseClient::on_done; diff --git a/libcmix-network/server.cpp b/libcmix-network/server.cpp index 195c5a0..a931c1e 100644 --- a/libcmix-network/server.cpp +++ b/libcmix-network/server.cpp @@ -66,6 +66,10 @@ Server::Server(io_service& io_service, const ListenSettings& listen_settings, st void Server::close() { - v4_acceptor.close(); - v6_acceptor.close(); + if(v4_acceptor.is_open()) { + v4_acceptor.close(); + } + if(v6_acceptor.is_open()) { + v6_acceptor.close(); + } }
\ No newline at end of file |
