aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/hicn/transport/interfaces/socket_consumer.cc')
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_consumer.cc12
1 files changed, 7 insertions, 5 deletions
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