TSVConn Arguments

To enable better Layer 4 routing it would be very helpful to be extend the transaction and session rguments to virtual connections. Plugins can then easily pass data from early intervention (layer 4) callbacks to transaction (layer 7) callbacks. For plugins such arguments only needto be attached to INKVConnInternal and NetVConnection as there aren’t any other virtual connection types accessible from the plugin API.

In terms of implementation the primary issue is adding a hook that a plugin can use to clean up resources. There are already sufficient early intervention hooks to set the data but both TS_HTTP_TXN_CLOSE_HOOK and TS_HTTP_SSN_CLOSE_HOOK hooks are insufficient in case of error before the client session is constructed. A new hook, TS_VCONN_CLOSE, is needed to do this cleanup. We should rename TS_VCONN_PRE_ACCEPT_HOOK to TS_VCONN_START_HOOK.

In terms of implementation we would add a std::vector to a class which would be inherited by INKVConnInternal and NetVConnection. This has a size of 24 bytes default constructed. When needed the vector would be extended to a compile time constant number of entries. This is a trade off from a constant sized array in that it is expected most instances will not have the arguments in which no memory is allocated. Only instances that need the data will allocate, reducing the overall memory footprint.

A sample man page is here.

The original discussion is here.