[TS-2862]: Addressing review comments from James Peach

Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7745fe58
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7745fe58
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7745fe58

Branch: refs/heads/master
Commit: 7745fe5803e652b1444138fbf416d059e623f086
Parents: cda01f5
Author: Sudheer Vinukonda <[email protected]>
Authored: Fri Oct 31 00:04:10 2014 +0000
Committer: Sudheer Vinukonda <[email protected]>
Committed: Fri Oct 31 00:04:10 2014 +0000

----------------------------------------------------------------------
 .../experimental/background_fetch/background_fetch.cc  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7745fe58/plugins/experimental/background_fetch/background_fetch.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/background_fetch/background_fetch.cc 
b/plugins/experimental/background_fetch/background_fetch.cc
index 04ad2ce..0f32345 100644
--- a/plugins/experimental/background_fetch/background_fetch.cc
+++ b/plugins/experimental/background_fetch/background_fetch.cc
@@ -802,6 +802,12 @@ TSPluginInit(int argc, const char* argv[])
     TSError("%s: plugin registration failed.\n", PLUGIN_NAME);
   }
 
+  if (TSHttpArgIndexReserve("background_fetch", "exclustion criteria index", 
&g_background_fetch_ArgIndex) != TS_SUCCESS) {
+    TSError("%s: Failed to reserve an argument index", PLUGIN_NAME);
+    TSAssert(0);
+    return;
+  }
+
   gConfig = new BGFetchConfig();
   optind = 1;
 
@@ -855,7 +861,7 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int 
errbuf_size)
 // We don't have any specific "instances" here, at least not yet.
 //
 TSReturnCode
-TSRemapNewInstance(int argc, char* argv[], void** ih, char* errbuf, int 
errbuf_size)
+TSRemapNewInstance(int  argc, char* argv[], void** ih, char* /* errbuf */, int 
/* errbuf_size */)
 {
   RemapInstance *ri = new RemapInstance();
   if (ri == NULL) {
@@ -864,12 +870,11 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, 
char* errbuf, int errbuf_s
   }
 
   char* fileName = NULL;
-  if (0 != access(argv[1], R_OK)) {
+  if (argc > 2 && 0 != access(argv[2], R_OK)) {
     fileName = argv[2];
     TSDebug(PLUGIN_NAME, "config file %s", fileName);
   }
 
-
   read_config(fileName, ri);
 
   *ih = (void*)ri;
@@ -888,7 +893,7 @@ TSRemapDeleteInstance(void* ih)
 //// This is the main "entry" point for the plugin, called for every request.
 ////
 TSRemapStatus
-TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
+TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo * /* rri */)
 {
   if (NULL == ih) {
     return TSREMAP_NO_REMAP;

Reply via email to