transport: Serialize socket write operations
Change-Id: Ieccaf0ccbd6ee8bd08b1eee77d781edd47b2cbb2
Refs: #1769, #1775
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index 6fab8e0..7ffe530 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -53,18 +53,21 @@
void
TcpTransport::send(const Block& wire)
{
+ BOOST_ASSERT(static_cast<bool>(m_impl));
m_impl->send(wire);
}
void
TcpTransport::send(const Block& header, const Block& payload)
{
+ BOOST_ASSERT(static_cast<bool>(m_impl));
m_impl->send(header, payload);
}
void
TcpTransport::close()
{
+ BOOST_ASSERT(static_cast<bool>(m_impl));
m_impl->close();
m_impl.reset();
}
@@ -72,12 +75,15 @@
void
TcpTransport::pause()
{
- m_impl->pause();
+ if (static_cast<bool>(m_impl)) {
+ m_impl->pause();
+ }
}
void
TcpTransport::resume()
{
+ BOOST_ASSERT(static_cast<bool>(m_impl));
m_impl->resume();
}