This is an automated email from the ASF dual-hosted git repository.

scw00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new c815b17  Update UDPNet for QUIC
c815b17 is described below

commit c815b17d3a855618620c9c9bcc491c0e68bcc4c1
Author: scw00 <sc...@apache.org>
AuthorDate: Thu May 30 14:38:42 2019 +0800

    Update UDPNet for QUIC
---
 iocore/net/P_UDPNet.h    |  2 ++
 iocore/net/P_UnixNet.h   | 20 ++++++++++++++++++++
 iocore/net/UnixUDPNet.cc |  2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index be2d896..f53c823 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -58,6 +58,8 @@ extern UDPNetProcessorInternal udpNetInternal;
 #define SLOT_TIME HRTIME_MSECONDS(SLOT_TIME_MSEC)
 #define N_SLOTS 2048
 
+constexpr int UDP_PERIOD = 9;
+
 class PacketQueue
 {
 public:
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index 7d591b0..a29cd7f 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -82,6 +82,7 @@ struct EventIO {
   int events = 0;
 #endif
   EventLoop event_loop = nullptr;
+  bool syscall         = true;
   int type             = 0;
   union {
     Continuation *c;
@@ -556,6 +557,10 @@ EventIO::start(EventLoop l, UnixUDPConnection *vc, int 
events)
 TS_INLINE int
 EventIO::close()
 {
+  if (!this->syscall) {
+    return 0;
+  }
+
   stop();
   switch (type) {
   default:
@@ -577,6 +582,10 @@ EventIO::close()
 TS_INLINE int
 EventIO::start(EventLoop l, int afd, Continuation *c, int e)
 {
+  if (!this->syscall) {
+    return 0;
+  }
+
   data.c     = c;
   fd         = afd;
   event_loop = l;
@@ -612,6 +621,10 @@ EventIO::start(EventLoop l, int afd, Continuation *c, int 
e)
 TS_INLINE int
 EventIO::modify(int e)
 {
+  if (!this->syscall) {
+    return 0;
+  }
+
   ink_assert(event_loop);
 #if TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER)
   struct epoll_event ev;
@@ -691,6 +704,10 @@ EventIO::modify(int e)
 TS_INLINE int
 EventIO::refresh(int e)
 {
+  if (!this->syscall) {
+    return 0;
+  }
+
   ink_assert(event_loop);
 #if TS_USE_KQUEUE && defined(USE_EDGE_TRIGGER)
   e = e & events;
@@ -732,6 +749,9 @@ EventIO::refresh(int e)
 TS_INLINE int
 EventIO::stop()
 {
+  if (!this->syscall) {
+    return 0;
+  }
   if (event_loop) {
     int retval = 0;
 #if TS_USE_EPOLL
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 13ac3af..8215cde 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -925,7 +925,7 @@ UDPNetHandler::startNetEvent(int event, Event *e)
   (void)event;
   SET_HANDLER((UDPNetContHandler)&UDPNetHandler::mainNetEvent);
   trigger_event = e;
-  e->schedule_every(-HRTIME_MSECONDS(9));
+  e->schedule_every(-HRTIME_MSECONDS(UDP_PERIOD));
   return EVENT_CONT;
 }
 

Reply via email to