This is an automated email from the ASF dual-hosted git repository.
oknet 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 c12d95e Ran unifdef to remove INACTIVITY_TIMEOUT code blocks
c12d95e is described below
commit c12d95ef875608654d1b8feb6cfbaee83497ac6a
Author: Masaori Koshiba <[email protected]>
AuthorDate: Sat Apr 22 12:19:26 2017 +0900
Ran unifdef to remove INACTIVITY_TIMEOUT code blocks
---
iocore/net/P_UnixNet.h | 19 ----------
iocore/net/P_UnixNetVConnection.h | 47 +----------------------
iocore/net/UnixNet.cc | 5 ---
iocore/net/UnixNetVConnection.cc | 79 ---------------------------------------
4 files changed, 2 insertions(+), 148 deletions(-)
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index 39d9ade..bd9b15a 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -126,7 +126,6 @@ extern int fds_limit;
extern ink_hrtime last_transient_accept_error;
extern int http_accept_port_number;
-//#define INACTIVITY_TIMEOUT
//
// Configuration Parameter had to move here to share
// between UnixNet and UnixUDPNet or SSLNet modules.
@@ -394,19 +393,10 @@ check_transient_accept_error(int res)
static inline void
read_disable(NetHandler *nh, UnixNetVConnection *vc)
{
-#ifdef INACTIVITY_TIMEOUT
- if (vc->inactivity_timeout) {
- if (!vc->write.enabled) {
- vc->inactivity_timeout->cancel_action();
- vc->inactivity_timeout = nullptr;
- }
- }
-#else
if (!vc->write.enabled) {
vc->set_inactivity_timeout(0);
Debug("socket", "read_disable updating inactivity_at %" PRId64 ",
NetVC=%p", vc->next_inactivity_timeout_at, vc);
}
-#endif
vc->read.enabled = 0;
nh->read_ready_list.remove(vc);
vc->ep.modify(-EVENTIO_READ);
@@ -415,19 +405,10 @@ read_disable(NetHandler *nh, UnixNetVConnection *vc)
static inline void
write_disable(NetHandler *nh, UnixNetVConnection *vc)
{
-#ifdef INACTIVITY_TIMEOUT
- if (vc->inactivity_timeout) {
- if (!vc->read.enabled) {
- vc->inactivity_timeout->cancel_action();
- vc->inactivity_timeout = nullptr;
- }
- }
-#else
if (!vc->read.enabled) {
vc->set_inactivity_timeout(0);
Debug("socket", "write_disable updating inactivity_at %" PRId64 ",
NetVC=%p", vc->next_inactivity_timeout_at, vc);
}
-#endif
vc->write.enabled = 0;
nh->write_ready_list.remove(vc);
vc->ep.modify(-EVENTIO_WRITE);
diff --git a/iocore/net/P_UnixNetVConnection.h
b/iocore/net/P_UnixNetVConnection.h
index 9335a5b..83d59a1 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -238,13 +238,8 @@ public:
ink_hrtime inactivity_timeout_in;
ink_hrtime active_timeout_in;
-#ifdef INACTIVITY_TIMEOUT
- Event *inactivity_timeout;
- Event *activity_timeout;
-#else
ink_hrtime next_inactivity_timeout_at;
ink_hrtime next_activity_timeout_at;
-#endif
EventIO ep;
NetHandler *nh;
@@ -347,30 +342,8 @@ TS_INLINE void
UnixNetVConnection::set_active_timeout(ink_hrtime timeout_in)
{
Debug("socket", "Set active timeout=%" PRId64 ", NetVC=%p", timeout_in,
this);
- active_timeout_in = timeout_in;
-#ifdef INACTIVITY_TIMEOUT
- if (active_timeout)
- active_timeout->cancel_action(this);
- if (active_timeout_in) {
- if (read.enabled) {
- ink_assert(read.vio.mutex->thread_holding == this_ethread() && thread);
- if (read.vio.mutex->thread_holding == thread)
- active_timeout = thread->schedule_in_local(this, active_timeout_in);
- else
- active_timeout = thread->schedule_in(this, active_timeout_in);
- } else if (write.enabled) {
- ink_assert(write.vio.mutex->thread_holding == this_ethread() && thread);
- if (write.vio.mutex->thread_holding == thread)
- active_timeout = thread->schedule_in_local(this, active_timeout_in);
- else
- active_timeout = thread->schedule_in(this, active_timeout_in);
- } else
- active_timeout = 0;
- } else
- active_timeout = 0;
-#else
+ active_timeout_in = timeout_in;
next_activity_timeout_at = Thread::get_hrtime() + timeout_in;
-#endif
}
TS_INLINE void
@@ -378,31 +351,15 @@ UnixNetVConnection::cancel_inactivity_timeout()
{
Debug("socket", "Cancel inactive timeout for NetVC=%p", this);
inactivity_timeout_in = 0;
-#ifdef INACTIVITY_TIMEOUT
- if (inactivity_timeout) {
- Debug("socket", "Cancel inactive timeout for NetVC=%p", this);
- inactivity_timeout->cancel_action(this);
- inactivity_timeout = nullptr;
- }
-#else
set_inactivity_timeout(0);
-#endif
}
TS_INLINE void
UnixNetVConnection::cancel_active_timeout()
{
Debug("socket", "Cancel active timeout for NetVC=%p", this);
- active_timeout_in = 0;
-#ifdef INACTIVITY_TIMEOUT
- if (active_timeout) {
- Debug("socket", "Cancel active timeout for NetVC=%p", this);
- active_timeout->cancel_action(this);
- active_timeout = nullptr;
- }
-#else
+ active_timeout_in = 0;
next_activity_timeout_at = 0;
-#endif
}
TS_INLINE int
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 233c99d..d0939cc 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -34,7 +34,6 @@ ink_hrtime last_transient_accept_error;
extern "C" void fd_reify(struct ev_loop *);
-#ifndef INACTIVITY_TIMEOUT
// INKqa10496
// One Inactivity cop runs on each thread once every second and
// loops through the list of NetVCs and calls the timeouts
@@ -98,8 +97,6 @@ public:
}
};
-#endif
-
PollCont::PollCont(Ptr<ProxyMutex> &m, int pt)
: Continuation(m.get()), net_handler(nullptr), nextPollDescriptor(nullptr),
poll_timeout(pt)
{
@@ -231,13 +228,11 @@ initialize_thread_for_net(EThread *thread)
thread->schedule_imm(get_NetHandler(thread));
-#ifndef INACTIVITY_TIMEOUT
InactivityCop *inactivityCop = new
InactivityCop(get_NetHandler(thread)->mutex);
int cop_freq = 1;
REC_ReadConfigInteger(cop_freq,
"proxy.config.net.inactivity_check_frequency");
thread->schedule_every(inactivityCop, HRTIME_SECONDS(cop_freq));
-#endif
thread->signal_hook = net_signal_hook_function;
thread->ep = (EventIO *)ats_malloc(sizeof(EventIO));
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index 0a2f9d1..c56a866 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -65,24 +65,11 @@ net_activity(UnixNetVConnection *vc, EThread *thread)
{
Debug("socket", "net_activity updating inactivity %" PRId64 ", NetVC=%p",
vc->inactivity_timeout_in, vc);
(void)thread;
-#ifdef INACTIVITY_TIMEOUT
- if (vc->inactivity_timeout && vc->inactivity_timeout_in &&
vc->inactivity_timeout->ethread == thread)
- vc->inactivity_timeout->schedule_in(vc->inactivity_timeout_in);
- else {
- if (vc->inactivity_timeout)
- vc->inactivity_timeout->cancel_action();
- if (vc->inactivity_timeout_in) {
- vc->inactivity_timeout = vc->thread->schedule_in_local(vc,
vc->inactivity_timeout_in);
- } else
- vc->inactivity_timeout = 0;
- }
-#else
if (vc->inactivity_timeout_in) {
vc->next_inactivity_timeout_at = Thread::get_hrtime() +
vc->inactivity_timeout_in;
} else {
vc->next_inactivity_timeout_at = 0;
}
-#endif
}
//
@@ -101,19 +88,8 @@ close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t)
ink_release_assert(vc->thread == t);
-#ifdef INACTIVITY_TIMEOUT
- if (vc->inactivity_timeout) {
- vc->inactivity_timeout->cancel_action(vc);
- vc->inactivity_timeout = nullptr;
- }
- if (vc->active_timeout) {
- vc->active_timeout->cancel_action(vc);
- vc->active_timeout = nullptr;
- }
-#else
vc->next_inactivity_timeout_at = 0;
vc->next_activity_timeout_at = 0;
-#endif
vc->inactivity_timeout_in = 0;
vc->active_timeout_in = 0;
@@ -937,13 +913,8 @@ UnixNetVConnection::UnixNetVConnection()
: closed(0),
inactivity_timeout_in(0),
active_timeout_in(0),
-#ifdef INACTIVITY_TIMEOUT
- inactivity_timeout(nullptr),
- active_timeout(nullptr),
-#else
next_inactivity_timeout_at(0),
next_activity_timeout_at(0),
-#endif
nh(nullptr),
id(0),
flags(0),
@@ -967,18 +938,9 @@ UnixNetVConnection::set_enabled(VIO *vio)
ink_assert(vio->mutex->thread_holding == this_ethread() && thread);
ink_release_assert(!closed);
STATE_FROM_VIO(vio)->enabled = 1;
-#ifdef INACTIVITY_TIMEOUT
- if (!inactivity_timeout && inactivity_timeout_in) {
- if (vio->mutex->thread_holding == thread)
- inactivity_timeout = thread->schedule_in_local(this,
inactivity_timeout_in);
- else
- inactivity_timeout = thread->schedule_in(this, inactivity_timeout_in);
- }
-#else
if (!next_inactivity_timeout_at && inactivity_timeout_in) {
next_inactivity_timeout_at = Thread::get_hrtime() + inactivity_timeout_in;
}
-#endif
}
void
@@ -1226,10 +1188,6 @@ UnixNetVConnection::mainEvent(int event, Event *e)
if (!hlock.is_locked() || !rlock.is_locked() || !wlock.is_locked() ||
(read.vio.mutex && rlock.get_mutex() != read.vio.mutex.get()) ||
(write.vio.mutex && wlock.get_mutex() != write.vio.mutex.get())) {
-#ifdef INACTIVITY_TIMEOUT
- if (e == active_timeout)
- e->schedule_in(HRTIME_MSECONDS(net_retry_delay));
-#endif
return EVENT_CONT;
}
@@ -1244,16 +1202,6 @@ UnixNetVConnection::mainEvent(int event, Event *e)
Event *t = nullptr;
Event **signal_timeout = &t;
-#ifdef INACTIVITY_TIMEOUT
- if (e == inactivity_timeout) {
- signal_event = VC_EVENT_INACTIVITY_TIMEOUT;
- signal_timeout = &inactivity_timeout;
- } else {
- ink_assert(e == active_timeout);
- signal_event = VC_EVENT_ACTIVE_TIMEOUT;
- signal_timeout = &active_timeout;
- }
-#else
if (event == EVENT_IMMEDIATE) {
/* BZ 49408 */
// ink_assert(inactivity_timeout_in);
@@ -1267,7 +1215,6 @@ UnixNetVConnection::mainEvent(int event, Event *e)
signal_event = VC_EVENT_ACTIVE_TIMEOUT;
signal_timeout_at = &next_activity_timeout_at;
}
-#endif
*signal_timeout = nullptr;
*signal_timeout_at = 0;
@@ -1451,9 +1398,6 @@ UnixNetVConnection::free(EThread *t)
ink_assert(!write.ready_link.prev && !write.ready_link.next);
ink_assert(!write.enable_link.next);
ink_assert(!link.next && !link.prev);
-#ifdef INACTIVITY_TIMEOUT
- ink_assert(!active_timeout);
-#endif
ink_assert(con.fd == NO_FD);
ink_assert(t == this_ethread());
@@ -1474,35 +1418,12 @@ TS_INLINE void
UnixNetVConnection::set_inactivity_timeout(ink_hrtime timeout_in)
{
Debug("socket", "Set inactive timeout=%" PRId64 ", for NetVC=%p",
timeout_in, this);
-#ifdef INACTIVITY_TIMEOUT
- if (inactivity_timeout)
- inactivity_timeout->cancel_action(this);
- if (timeout_in) {
- inactivity_timeout_in = timeout_in;
- if (read.enabled) {
- ink_assert(read.vio.mutex->thread_holding == this_ethread() && thread);
- if (read.vio.mutex->thread_holding == thread)
- inactivity_timeout = thread->schedule_in_local(this,
inactivity_timeout_in);
- else
- inactivity_timeout = thread->schedule_in(this, inactivity_timeout_in);
- } else if (write.enabled) {
- ink_assert(write.vio.mutex->thread_holding == this_ethread() && thread);
- if (write.vio.mutex->thread_holding == thread)
- inactivity_timeout = thread->schedule_in_local(this,
inactivity_timeout_in);
- else
- inactivity_timeout = thread->schedule_in(this, inactivity_timeout_in);
- } else
- inactivity_timeout = 0;
- } else
- inactivity_timeout = 0;
-#else
if (timeout_in == 0) {
// set default inactivity timeout
timeout_in = HRTIME_SECONDS(nh->default_inactivity_timeout);
}
inactivity_timeout_in = timeout_in;
next_inactivity_timeout_at = Thread::get_hrtime() + inactivity_timeout_in;
-#endif
}
/*
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].