TSHttpSsnClientReceivedErrorGet

Synopsis

#include <ts/ts.h>
void TSHttpSsnClientReceivedErrorGet(TSHttpSsn ssnp, uint32_t *error_class, uint64_t *error_code)
void TSHttpSsnClientSentErrorGet(TSHttpSsn ssnp, uint32_t *error_class, uint64_t *error_code)

Description

These functions retrieve the most recent connection error received from or sent to an HTTP/2 client. They can be used from a session hook, including TS_HTTP_SSN_CLOSE_HOOK, even when the connection never created an HTTP transaction. Both output pointers must be non-null. The caller must hold the session mutex, as is the case in a session hook callback.

error_class is zero when no connection error information is available and one for a connection error. error_code is the HTTP/2 GOAWAY error code. A code of zero denotes NO_ERROR and is a normal shutdown, even when the class is one. For other client protocols both outputs are zero.

These are snapshots of the latest GOAWAY state, not cumulative counters. They do not report stream errors. The corresponding transaction accessors provide stream error information. A connection error can also be copied to several transactions during teardown; consumers counting errors should count it once at session close rather than once per affected transaction.

The session and returned error values may be used until the session-close callback reenables the session with TSHttpSsnReenable(). The client VConn may already be unavailable at that point. Plugins that need the client address should preserve it from the session-start hook.