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

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

    [ https://issues.apache.org/jira/browse/TS-4035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15021348#comment-15021348 ] 

ASF subversion and git services commented on TS-4035:
-----------------------------------------------------

Commit 91e121ac74f1c7adc524f7d10cab23fa9d741d92 in trafficserver's branch refs/heads/master from [~jpeach@apache.org]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=91e121a ]

TS-4035: simple plugin code documentation is wrong

Remove in-line example code in favor of including plugin example
code that builds. Fix API links. Update the plugin code to not use
Traffic Server internal headers.


> 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
>             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)