trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject trafficserver git commit: TS-3058: Fix TSVConnClosedGet to work with PluginVC and UnixNetVConnection instances.
Date Wed, 17 Jun 2015 21:52:51 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 32d7f42fd -> 62d9afa41


TS-3058: Fix TSVConnClosedGet to work with PluginVC and UnixNetVConnection instances.


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

Branch: refs/heads/master
Commit: 62d9afa411df4436f62b28e8abfae45a03491df4
Parents: 32d7f42
Author: Alan M. Carroll <amc@apache.org>
Authored: Wed Jun 17 16:52:13 2015 -0500
Committer: Alan M. Carroll <amc@apache.org>
Committed: Wed Jun 17 16:52:13 2015 -0500

----------------------------------------------------------------------
 CHANGES                            | 2 ++
 iocore/eventsystem/I_VConnection.h | 3 ++-
 iocore/net/UnixNetVConnection.cc   | 4 ++++
 proxy/InkAPI.cc                    | 6 +++---
 proxy/InkAPITest.cc                | 2 ++
 proxy/PluginVC.cc                  | 3 +++
 proxy/PluginVC.h                   | 2 +-
 7 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 35ad6e2..9a26e4e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3058]: Fix TSVConnGetClosed to return a useful value in more situations.
+
   *) [TS-3153]: Add SessionAccept object pointer  to SSLNetVC.
 
   *) [TS-3696] Fix range check in HdrHeap::attach_str_heap() such that gcc 5.1

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/iocore/eventsystem/I_VConnection.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_VConnection.h b/iocore/eventsystem/I_VConnection.h
index 559e537..a9b0469 100644
--- a/iocore/eventsystem/I_VConnection.h
+++ b/iocore/eventsystem/I_VConnection.h
@@ -129,7 +129,8 @@ enum TSApiDataType {
   TS_API_DATA_READ_VIO = VCONNECTION_API_DATA_BASE,
   TS_API_DATA_WRITE_VIO,
   TS_API_DATA_OUTPUT_VC,
-  TS_API_DATA_CLOSED
+  TS_API_DATA_CLOSED,
+  TS_API_DATA_LAST ///< Used by other classes to extend the enum values.
 };
 
 extern "C" {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/iocore/net/UnixNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index f1ce525..72999cf 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -563,6 +563,7 @@ UnixNetVConnection::get_data(int id, void *data)
   union {
     TSVIO *vio;
     void *data;
+    int *n;
   } ptr;
 
   ptr.data = data;
@@ -574,6 +575,9 @@ UnixNetVConnection::get_data(int id, void *data)
   case TS_API_DATA_WRITE_VIO:
     *ptr.vio = (TSVIO) & this->write.vio;
     return true;
+  case TS_API_DATA_CLOSED:
+    *ptr.n = this->closed;
+    return true;
   default:
     return false;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index e8eaa78..96dede2 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -6349,9 +6349,9 @@ TSVConnClosedGet(TSVConn connp)
   sdk_assert(sdk_sanity_check_iocore_structure(connp) == TS_SUCCESS);
 
   VConnection *vc = (VConnection *)connp;
-  int data;
-
-  vc->get_data(TS_API_DATA_CLOSED, &data); // Can not fail for this case
+  int data = 0;
+  bool f = vc->get_data(TS_API_DATA_CLOSED, &data);
+  ink_assert(f); // This can fail in some cases, we need to track those down.
   return data;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index ef3f6e8..a8507b1 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7109,6 +7109,8 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_TSHttpConnectIntercept)(RegressionTest
*test,
   sockaddr_in addr;
   ats_ip4_set(&addr, 1, 1);
   data->vc = TSHttpConnect(ats_ip_sa_cast(&addr));
+  if (TSVConnClosedGet(data->vc))
+    SDK_RPRINT(data->test, "TSHttpConnect", "TestCase 1", TC_FAIL, "Connect reported as
closed immediately after open");
   synclient_txn_send_request_to_vc(data->browser, data->request, data->vc);
 
   /* Wait until transaction is done */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/proxy/PluginVC.cc
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 5b72626..d0d6861 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -938,6 +938,9 @@ PluginVC::get_data(int id, void *data)
       *(void **)data = core_obj->active_data;
     }
     return true;
+  case TS_API_DATA_CLOSED:
+    *static_cast<int*>(data) = this->closed;
+    return true;
   default:
     *(void **)data = NULL;
     return false;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62d9afa4/proxy/PluginVC.h
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.h b/proxy/PluginVC.h
index 4e197f1..ef2a5d5 100644
--- a/proxy/PluginVC.h
+++ b/proxy/PluginVC.h
@@ -60,7 +60,7 @@ enum PluginVC_t {
 
 // For the id in set_data/get_data
 enum {
-  PLUGIN_VC_DATA_LOCAL,
+  PLUGIN_VC_DATA_LOCAL = TS_API_DATA_LAST,
   PLUGIN_VC_DATA_REMOTE,
 };
 


Mime
View raw message