You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ez...@apache.org on 2021/08/09 23:18:50 UTC
[trafficserver] branch 8.1.x updated: Revert "Remove
UnixNetVConnection::startEvent - not actually called. (#7596) (#8195)
This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.1.x by this push:
new c5bcc73 Revert "Remove UnixNetVConnection::startEvent - not actually called. (#7596) (#8195)
c5bcc73 is described below
commit c5bcc73c9e09da7191d3705f42f1a2cb8c0489ea
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Aug 10 08:18:41 2021 +0900
Revert "Remove UnixNetVConnection::startEvent - not actually called. (#7596) (#8195)
* Revert "Remove UnixNetVConnection::startEvent - not actually called. (#7596)"
This reverts commit a56638f8ba92c48e2cc8b677438c36e13f393e2b.
* Fix a use-after-free reported by clang-analyzer
Co-authored-by: Tomoaki Tanaka <to...@yahoo-corp.jp>
(cherry picked from commit 6efb8d8090b9f6f820e8dd48505134af143c7005)
Conflicts:
iocore/net/P_QUICNetVConnection.h
iocore/net/QUICNetProcessor.cc
iocore/net/QUICNetVConnection.cc
iocore/net/UnixNetVConnection.cc
---
iocore/net/P_UnixNetVConnection.h | 1 +
iocore/net/SSLNetVConnection.cc | 1 +
iocore/net/UnixNetVConnection.cc | 18 ++++++++++++++++++
3 files changed, 20 insertions(+)
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index 37b4278..1fef6b9 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -266,6 +266,7 @@ public:
const sockaddr *origin_trace_addr;
int origin_trace_port;
+ int startEvent(int event, Event *e);
int acceptEvent(int event, Event *e);
int mainEvent(int event, Event *e);
virtual int connectUp(EThread *t, int fd);
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 881b71a..72b6913 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -957,6 +957,7 @@ SSLNetVConnection::free(EThread *t)
con.close();
clear();
+ SET_CONTINUATION_HANDLER(this, (SSLNetVConnHandler)&SSLNetVConnection::startEvent);
ink_assert(con.fd == NO_FD);
ink_assert(t == this_ethread());
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index 6fb6fa8..242e479 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -894,6 +894,7 @@ UnixNetVConnection::UnixNetVConnection()
origin_trace_addr(nullptr),
origin_trace_port(0)
{
+ SET_HANDLER((NetVConnHandler)&UnixNetVConnection::startEvent);
}
// Private methods
@@ -1068,6 +1069,22 @@ UnixNetVConnection::netActivity(EThread *lthread)
}
int
+UnixNetVConnection::startEvent(int /* event ATS_UNUSED */, Event *e)
+{
+ MUTEX_TRY_LOCK(lock, get_NetHandler(e->ethread)->mutex, e->ethread);
+ if (!lock.is_locked()) {
+ e->schedule_in(HRTIME_MSECONDS(net_retry_delay));
+ return EVENT_CONT;
+ }
+ if (!action_.cancelled) {
+ connectUp(e->ethread, NO_FD);
+ } else {
+ this->free(e->ethread);
+ }
+ return EVENT_DONE;
+}
+
+int
UnixNetVConnection::acceptEvent(int event, Event *e)
{
EThread *t = (e == nullptr) ? this_ethread() : e->ethread;
@@ -1356,6 +1373,7 @@ UnixNetVConnection::free(EThread *t)
con.close();
clear();
+ SET_CONTINUATION_HANDLER(this, (NetVConnHandler)&UnixNetVConnection::startEvent);
ink_assert(con.fd == NO_FD);
ink_assert(t == this_ethread());