}
}
} catch (...) {
- stopThisConnection();
+ // The connection is dead and there can't be a pending write as
+ // they are in sequence.
+ TcpConnection::stopThisConnection();
}
}
} else if ((ec.value() != boost::asio::error::try_again) &&
(ec.value() != boost::asio::error::would_block)) {
stopThisConnection();
+ return;
// We got EWOULDBLOCK or EAGAIN which indicate that we may be able to
// read something from the socket on the next attempt. Just make sure
// treated as fatal error.
} else if ((ec.value() != boost::asio::error::try_again) &&
(ec.value() != boost::asio::error::would_block)) {
- stopThisConnection();
- // @todo TKM shouldn't there be a return here?
+ // The connection is dead and there can't be a pending write as
+ // they are in sequence.
+ TcpConnection::stopThisConnection();
+ return;
// We got EWOULDBLOCK or EAGAIN which indicate that we may be able to
// read something from the socket on the next attempt.
/// @brief Shuts down current connection.
///
/// Copied from the next method @ref stopThisConnection
- void shutdownConnection();
+ virtual void shutdownConnection();
/// @brief Stops current connection.
- void stopThisConnection();
+ virtual void stopThisConnection();
/// @brief returns remote address in textual form
std::string getRemoteEndpointAddressAsText() const;
void stop(const TcpConnectionPtr& connection);
/// @brief Stops all connections and removes them from the pool.
+ ///
+ /// @note This function is not thread-safe so should be called
+ /// when the thread pool is stopped.
void stopAll();
/// @brief Returns the number of connections using a given remote IP address.