// ongoing transactions, we close it. This will unregister it from
// IfaceMgr and ensure the client starts over with a fresh connection
// if it needs to do so.
- client_.closeIfOutOfBandwidth(tcp_native_fd);
+ client_.closeIfOutOfBand(tcp_native_fd);
}
void
/// flagged as ready to read. It is installed by the invocation to
/// register the socket with IfaceMgr made in @ref clientConnectHandler.
///
- /// The handler calls @c http::HttpClient::closeIfOutOfBandwidth() to catch
+ /// The handler calls @c http::HttpClient::closeIfOutOfBand() to catch
/// and close any sockets that have gone ready outside of transactions.
///
/// We do this in case the other peer closed the socket (e.g. idle timeout),
}
}
- /// @brief Closes a connection if it has an out-of-bandwidth socket event
+ /// @brief Closes a connection if it has an out-of-band socket event
///
/// If the pool contains a connection using the given socket and that
/// connection is currently in a transaction the method returns as this
/// case is the other end of the socket being closed.
///
/// @param socket_fd socket descriptor to check
- void closeIfOutOfBandwidth(int socket_fd) {
+ void closeIfOutOfBand(int socket_fd) {
if (MultiThreadingMgr::instance().getMode()) {
std::lock_guard<std::mutex> lk(mutex_);
- closeIfOutOfBandwidthInternal(socket_fd);
+ closeIfOutOfBandInternal(socket_fd);
} else {
- closeIfOutOfBandwidthInternal(socket_fd);
+ closeIfOutOfBandInternal(socket_fd);
}
}
queue_.clear();
}
- /// @brief Closes a connection if it has an out-of-bandwidth socket event
+ /// @brief Closes a connection if it has an out-of-band socket event
///
/// If the pool contains a connection using the given socket and that
/// connection is currently in a transaction the method returns as this
/// This method should be called in a thread safe context.
///
/// @param socket_fd socket descriptor to check
- void closeIfOutOfBandwidthInternal(int socket_fd) {
+ void closeIfOutOfBandInternal(int socket_fd) {
// First we look for a connection with the socket.
for (auto conns_it = conns_.begin(); conns_it != conns_.end();
++conns_it) {
}
// Socket has no transaction, so any ready event is
- // out-of-bandwidth (other end probably closed), so
+ // out-of-band (other end probably closed), so
// let's close it. Note we do not remove any queued
// requests, as this might somehow be occurring in
// between them.
}
void
-HttpClient::closeIfOutOfBandwidth(int socket_fd) {
- return (impl_->conn_pool_->closeIfOutOfBandwidth(socket_fd));
+HttpClient::closeIfOutOfBand(int socket_fd) {
+ return (impl_->conn_pool_->closeIfOutOfBand(socket_fd));
}
void
/// @brief Closes all connections.
void stop();
- /// @brief Closes a connection if it has an out-of-bandwidth socket event
+ /// @brief Closes a connection if it has an out-of-band socket event
///
/// If the client owns a connection using the given socket and that
/// connection is currently in a transaction the method returns as this
/// ongoing transaction, then the connection is closed.
///
/// This is method is intended to be used to detect and clean up then
- /// sockets that are marked ready outside of transactions. The most comman
+ /// sockets that are marked ready outside of transactions. The most common
/// case is the other end of the socket being closed.
///
/// @param socket_fd socket descriptor to check
- void closeIfOutOfBandwidth(int socket_fd);
+ void closeIfOutOfBand(int socket_fd);
private:
EXPECT_EQ(-1, monitor.registered_fd_);
}
- /// @brief Tests detection and handling out-of-bandwidth socket events
+ /// @brief Tests detection and handling out-of-band socket events
///
- /// It initiates a transacation and verifies that a mid-transacation call
- /// to HttpClient::closeIfOutOfBandwidth() has no affect on the connection.
- /// After succesful completion of the transaction, a second call is made
- /// HttpClient::closeIfOutOfBandwidth(). This should result in the connection
- /// being closed.
+ /// It initiates a transaction and verifies that a mid-transaction call
+ /// to HttpClient::closeIfOutOfBand() has no affect on the connection.
+ /// After successful completion of the transaction, a second call to
+ /// HttpClient::closeIfOutOfBand() is made. This should result in the
+ /// connection being closed.
/// This step is repeated to verify that after an OOB closure, transactions
/// to the same destination can be processed.
///
/// Lastly, we verify that HttpClient::stop() closes the connection correctly.
///
/// @param version HTTP version to be used.
- void testCloseIfOutOfBandwidth(const HttpVersion& version) {
+ void testCloseIfOutOfBand(const HttpVersion& version) {
// Start the server.
ASSERT_NO_THROW(listener_.start());
int orig_fd = monitor.registered_fd_;
// Test our socket for OOBness.
- client.closeIfOutOfBandwidth(monitor.registered_fd_);
+ client.closeIfOutOfBand(monitor.registered_fd_);
// Since we're in a transaction, we should have no closes and
// the same valid fd.
EXPECT_GT(monitor.registered_fd_, -1);
// Test our socket for OOBness.
- client.closeIfOutOfBandwidth(monitor.registered_fd_);
+ client.closeIfOutOfBand(monitor.registered_fd_);
// Since we're in a transaction, we should have no closes and
// the same valid fd.
int orig_fd = monitor.registered_fd_;
// Test our socket for OOBness.
- client.closeIfOutOfBandwidth(monitor.registered_fd_);
+ client.closeIfOutOfBand(monitor.registered_fd_);
// Since we're in a transaction, we should have no closes and
// the same valid fd.
ASSERT_NO_FATAL_FAILURE(testConnectCloseCallbacks(HttpVersion(1, 1)));
}
-/// Tests that HttpClient::closeIfOutOfBandwidth works correctly.
-TEST_F(HttpClientTest, closeIfOutOfBandwidth) {
- ASSERT_NO_FATAL_FAILURE(testCloseIfOutOfBandwidth(HttpVersion(1, 1)));
+/// Tests that HttpClient::closeIfOutOfBand works correctly.
+TEST_F(HttpClientTest, closeIfOutOfBand) {
+ ASSERT_NO_FATAL_FAILURE(testCloseIfOutOfBand(HttpVersion(1, 1)));
}
-/// Tests that HttpClient::closeIfOutOfBandwidth works correctly.
-TEST_F(HttpClientTest, closeIfOutOfBandwidthMultiThreading) {
+/// Tests that HttpClient::closeIfOutOfBand works correctly.
+TEST_F(HttpClientTest, closeIfOutOfBandMultiThreading) {
MultiThreadingMgr::instance().setMode(true);
- ASSERT_NO_FATAL_FAILURE(testCloseIfOutOfBandwidth(HttpVersion(1, 1)));
+ ASSERT_NO_FATAL_FAILURE(testCloseIfOutOfBand(HttpVersion(1, 1)));
}
}