trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1228317 - in /trafficserver/traffic/trunk: CHANGES iocore/eventsystem/I_VConnection.h iocore/net/P_UnixNetVConnection.h iocore/net/UnixNetVConnection.cc proxy/InkAPI.cc proxy/api/ts/InkAPIPrivateIOCore.h
Date Fri, 06 Jan 2012 18:05:46 GMT
Author: zwoop
Date: Fri Jan  6 18:05:46 2012
New Revision: 1228317

URL: http://svn.apache.org/viewvc?rev=1228317&view=rev
Log:
TS-1044 Fix TSVConn{Read,Write}VIOGet in UnixNetVConnection.
Author: James Peach.

Modified:
    trafficserver/traffic/trunk/CHANGES
    trafficserver/traffic/trunk/iocore/eventsystem/I_VConnection.h
    trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h
    trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h

Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1228317&r1=1228316&r2=1228317&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Fri Jan  6 18:05:46 2012
@@ -1,5 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.2
+  *) [TS-1044] Fix TSVConn{Read,Write}VIOGet in UnixNetVConnection.
+    Author: James Peach.
+
   *) [TS-1040] Teach TSHostLookup to use const. Author: James Peach.
 
   *) [TS-1071] Debug statement in FetchSM broken. Author: Brian Geffon.

Modified: trafficserver/traffic/trunk/iocore/eventsystem/I_VConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/I_VConnection.h?rev=1228317&r1=1228316&r2=1228317&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/I_VConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/I_VConnection.h Fri Jan  6 18:05:46 2012
@@ -127,6 +127,19 @@ enum ShutdownHowTo_t
   IO_SHUTDOWN_READWRITE
 };
 
+/** Used in VConnection::get_data(). */
+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
+};
+
+extern "C" {
+    typedef struct tsapi_vio* TSVIO;
+}
+
 /**
   Base class for the connection classes that provide IO capabilities.
 

Modified: trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h?rev=1228317&r1=1228316&r2=1228317&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h Fri Jan  6 18:05:46 2012
@@ -95,6 +95,8 @@ public:
   virtual VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf);
   virtual VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner
= false);
 
+  virtual bool get_data(int id, void *data);
+
   virtual Action *send_OOB(Continuation *cont, char *buf, int len);
   virtual void cancel_OOB();
 

Modified: trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc?rev=1228317&r1=1228316&r2=1228317&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc Fri Jan  6 18:05:46 2012
@@ -498,6 +498,27 @@ write_to_net_io(NetHandler *nh, UnixNetV
   }
 }
 
+bool
+UnixNetVConnection::get_data(int id, void *data)
+{
+  union {
+    TSVIO * vio;
+    void * data;
+  } ptr;
+
+  ptr.data = data;
+
+  switch (id) {
+  case TS_API_DATA_READ_VIO:
+    *ptr.vio = (TSVIO)&this->read.vio;
+    return true;
+  case TS_API_DATA_WRITE_VIO:
+    *ptr.vio = (TSVIO)&this->write.vio;
+    return true;
+  default:
+    return false;
+  }
+}
 
 VIO *
 UnixNetVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1228317&r1=1228316&r2=1228317&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Fri Jan  6 18:05:46 2012
@@ -6056,8 +6056,11 @@ TSVConnReadVIOGet(TSVConn connp)
   VConnection *vc = (VConnection *)connp;
   TSVIO data;
 
-  vc->get_data(TS_API_DATA_READ_VIO, &data); // Can not fail for this case
-  return data;
+  if (vc->get_data(TS_API_DATA_READ_VIO, &data)) {
+    return data;
+  }
+
+  return NULL;
 }
 
 TSVIO
@@ -6068,8 +6071,11 @@ TSVConnWriteVIOGet(TSVConn connp)
   VConnection *vc = (VConnection *) connp;
   TSVIO data;
 
-  vc->get_data(TS_API_DATA_WRITE_VIO, &data); // Can not fail for this case
-  return data;
+  if (vc->get_data(TS_API_DATA_WRITE_VIO, &data)) {
+    return data;
+  }
+
+  return NULL;
 }
 
 int

Modified: trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h?rev=1228317&r1=1228316&r2=1228317&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h Fri Jan  6 18:05:46 2012
@@ -64,14 +64,6 @@ public:
 };
 
 
-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
-};
-
 
 class INKVConnInternal:public INKContInternal
 {



Mime
View raw message