int64_t *size_ptr; /* pointer to size in an ConnStateData for logging */
Comm::ConnectionPointer conn; ///< The currently connected connection.
-#define fd_closed(X) ((X) == NULL || !(X)->isOpen() || fd_table[(X)->fd].closing())
private:
#if DELAY_POOLS
cbdataInternalLock(this); /* ??? should be locked by the caller... */
/* Bump the server connection timeout on any activity */
- if (!fd_closed(server.conn))
+ if (Comm::IsConnOpen(server.conn))
commSetTimeout(server.conn->fd, Config.Timeout.read, tunnelTimeout, this);
if (len < 0 || errcode)
from.conn->close();
/* Only close the remote end if we've finished queueing data to it */
- if (from.len == 0 && !fd_closed(to.conn) ) {
+ if (from.len == 0 && Comm::IsConnOpen(to.conn) ) {
to.conn->close();
}
} else if (cbdataReferenceValid(this))
client.dataSent(len);
/* If the other end has closed, so should we */
- if (fd_closed(client.conn)) {
+ if (!Comm::IsConnOpen(client.conn)) {
server.conn->close();
return;
}
server.dataSent(len);
/* If the other end has closed, so should we */
- if (fd_closed(server.conn)) {
+ if (!Comm::IsConnOpen(server.conn)) {
client.conn->close();
return;
}
void
TunnelStateData::Connection::closeIfOpen()
{
- if (!fd_closed(conn))
+ if (Comm::IsConnOpen(conn))
conn->close();
}
/* temporary lock to save our own feets (comm_close -> tunnelClientClosed -> Free) */
cbdataInternalLock(tunnelState);
- if (!fd_closed(tunnelState->client.conn))
+ if (Comm::IsConnOpen(tunnelState->client.conn))
tunnelState->client.conn->close();
- if (!fd_closed(tunnelState->server.conn))
+ if (Comm::IsConnOpen(tunnelState->server.conn))
tunnelState->server.conn->close();
cbdataInternalUnlock(tunnelState);
bool
TunnelStateData::noConnections() const
{
- return fd_closed(server.conn) && fd_closed(client.conn);
+ return !Comm::IsConnOpen(server.conn) && !Comm::IsConnOpen(client.conn);
}
#if DELAY_POOLS