From b375370d0f11163da8cb752c4a3f992a89ef80ee Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 16 Apr 2019 18:38:07 +0200 Subject: [HICN-178] Sync send of control messages. Change-Id: I9a07c6c806ceba10f80a5f67337dce2eee76120d Signed-off-by: Mauro Sardara --- .../src/hicn/transport/interfaces/socket_consumer.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libtransport/src/hicn/transport/interfaces/socket_consumer.cc') diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc index 37d545779..af99fd60c 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc +++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc @@ -123,10 +123,12 @@ void ConsumerSocket::asyncSendInterest(Interest::Ptr &&interest, } void ConsumerSocket::stop() { - if (transport_protocol_->isRunning()) { - std::cout << "Stopping transport protocol " << std::endl; - transport_protocol_->stop(); - } + auto &io_service = getIoService(); + io_service.dispatch([this]() { + if (transport_protocol_->isRunning()) { + transport_protocol_->stop(); + } + }); } void ConsumerSocket::resume() { @@ -141,4 +143,4 @@ asio::io_service &ConsumerSocket::getIoService() { } // namespace interface -} // end namespace transport +} // end namespace transport \ No newline at end of file -- cgit 1.2.3-korg