You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (JIRA)" <ji...@apache.org> on 2016/01/13 07:11:40 UTC
[jira] [Updated] (TS-4035) Simple plugin code is wrong
[ https://issues.apache.org/jira/browse/TS-4035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Leif Hedstrom updated TS-4035:
------------------------------
Summary: Simple plugin code is wrong (was: SImple plugin code is wrong)
> 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)