MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / isStale

Method isStale

src/Common/HTTPConnectionPool.cpp:823–833  ·  view source on GitHub ↗

Detect connections that have been silently closed by the remote end. An idle keep-alive connection should have no data pending in the socket. If poll(SELECT_READ, 0) returns true on such a connection, it means the server has sent a FIN (or RST), so the next request on this connection would fail with "No message received" (NoMessageException).

Source from the content-addressed store, hash-verified

821 /// server has sent a FIN (or RST), so the next request on this connection
822 /// would fail with "No message received" (NoMessageException).
823 static bool isStale(Session & connection)
824 {
825 try
826 {
827 return connection.socket().poll(Poco::Timespan(0), Poco::Net::Socket::SELECT_READ);
828 }
829 catch (Poco::IOException &)
830 {
831 return true;
832 }
833 }
834
835
836 ConnectionPtr prepareNewConnection(const ConnectionTimeouts & timeouts, UInt64 * connect_time)

Callers

nothing calls this directly

Calls 3

TimespanClass · 0.50
pollMethod · 0.45
socketMethod · 0.45

Tested by

no test coverage detected