You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "James Peach (JIRA)" <ji...@apache.org> on 2015/11/23 02:40:11 UTC

[jira] [Resolved] (TS-4035) SImple plugin code is wrong

     [ https://issues.apache.org/jira/browse/TS-4035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Peach resolved TS-4035.
-----------------------------
       Resolution: Fixed
         Assignee: James Peach
    Fix Version/s: 6.1.0

Fixed! Look for a docs update once RTD crunches it.

> SImple plugin code is wrong
> ---------------------------
>
>                 Key: TS-4035
>                 URL: https://issues.apache.org/jira/browse/TS-4035
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Documentation
>            Reporter: Joseph Hindin
>            Assignee: James Peach
>             Fix For: 6.1.0
>
>
> The simple plugin code, presented in the [plugin development documentation|https://trafficserver.readthedocs.org/en/latest/developer-guide/plugins/getting-started/plugin-registration-and-version-checking.en.html] , contains the following code snippet:
> {code:title=hello-world.c}
> if (!TSPluginRegister(&info))  {
>          TSError ("[plugin_name] Plugin registration failed.");
> } 
> {code}
> But the header file defines the return code in the following way:
> {code:title=ts/apidef.h}
> typedef enum { TS_ERROR = -1, TS_SUCCESS = 0 } TSReturnCode;
> {code}
> Apparently, in case of success the return code is 0 and non-zero in case of failure, so the sample code is expected to be
> {code:title=hello-world.c suggested fix for condition}
> if (TSPluginRegister(&info))  {
>          TSError ("[plugin_name] Plugin registration failed.");
> } 
> {code}
> Also, it seems that on error {{TSPlugInit}} function should return immediately, like in the following suggestion:
> {code:title=hello-world.c suggested fix}
> if (TSPluginRegister(&info))  {
>          TSError ("[plugin_name] Plugin registration failed.");
>          return;
> } 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)