TSHttpTxnServerAddrSet¶
Synopsis¶
#include <ts/ts.h>
-
TSReturnCode
TSHttpTxnServerAddrSet
(TSHttpTxn txnp, struct sockaddr const* addr)¶
Description¶
Set the origin server address for transaction txnp. This includes the port in addr. The address family is also set by the contents of addr. The address data is copied out of addr so there is no dependency on the lifetime of that object.
This hook must be called no later than TS_HTTP_OS_DNS_HOOK. If this is called prior to TS_HTTP_OS_DNS_HOOK, DNS resolution will not be done as the address of the server is already known.
Return Value¶
TS_ERROR
is returned if addr does not contain a valid
IPv4 or IPv6 address with a valid (non-zero) port.
Notes¶
If Traffic Server is configured to retry connections to origin servers and
TSHttpTxnServerAddrGet()
has been called, Traffic Server will return
to TS_HTTP_OS_DNS_HOOK so to let the plugin set a different server
address. Plugins should be prepared for TS_HTTP_OS_DNS_HOOK and any
subsequent hooks to be called multiple times.
Once a plugin calls TSHttpTxnServerAddrGet()
any prior DNS
resolution results are lost. The plugin should use
TSHttpTxnServerAddrGet()
to preserve any DNS Results that
might need.
See Also¶
TSAPI(3ts), TSHttpTxnServerAddrGet(3ts)