Hi [email protected],

This concerns an incompatible change to the TSPortDescriptor plugin API.

Currently, TSPortDescriptorParse() allocates an internal HttpProxyPort and
returns it as an opaque handle:

TSPortDescriptor TSPortDescriptorParse(const char *descriptor);
TSReturnCode TSPortDescriptorAccept(TSPortDescriptor descriptor, TSCont
contp);

There is no API for releasing that allocation, so every successfully parsed
descriptor leaks for the lifetime of Traffic Server. This problem is
recorded in the following issue:

https://github.com/apache/trafficserver/issues/6894

The proposed API instead uses caller-owned opaque storage (the fix
suggested by Alan Carroll in this issue):

TSReturnCode TSPortDescriptorParse(
    const char *descriptor,
    TSPortDescriptor *result);

TSReturnCode TSPortDescriptorAccept(
    const TSPortDescriptor *descriptor,
    TSCont contp);

TSPortDescriptorParse() initializes the caller-provided object, and
TSPortDescriptorAccept() does not retain it. The descriptor can therefore
be stack-allocated and released normally as soon as the caller's scope
exits.

An implementation is in PR #13518 which I will currently mark as a draft
while leaving time for the community to reply to this email:
https://github.com/apache/trafficserver/pull/13518

Since this changes public API signatures, please let me know whether there
are objections or alternative approaches we should consider.

Kind regards,
Brian Neradt

-- 
"Come to Me, all who are weary and heavy-laden, and I will
give you rest. Take My yoke upon you and learn from Me, for
I am gentle and humble in heart, and you will find rest for
your souls. For My yoke is easy and My burden is light."

    ~ Matthew 11:28-30

Reply via email to