You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2023/09/27 21:55:50 UTC
[trafficserver] branch master updated: stub.cc cleanup (#10471)
This is an automated email from the ASF dual-hosted git repository.
bneradt 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 48eb58891d stub.cc cleanup (#10471)
48eb58891d is described below
commit 48eb58891da4e344687586e1c875a0dc84a4fc5c
Author: Zhengxi Li <lz...@hotmail.com>
AuthorDate: Wed Sep 27 17:55:42 2023 -0400
stub.cc cleanup (#10471)
Pruned down cache/test/stub.cc and net/libinknet_stub.cc.
Re-arranged sourced files within src/api
---
iocore/cache/Makefile.am | 1 +
iocore/cache/test/stub.cc | 127 ------------------
iocore/net/libinknet_stub.cc | 10 --
proxy/http/Makefile.am | 3 +
proxy/http/unit_tests/CMakeLists.txt | 1 +
src/api/CMakeLists.txt | 9 +-
src/api/ConfigUpdateCbTable.cc | 64 +++++++++
src/api/InkAPI.cc | 246 +----------------------------------
src/api/InkVConnInternal.cc | 213 ++++++++++++++++++++++++++++++
src/api/Makefile.am | 4 +-
src/tests/CMakeLists.txt | 3 +-
11 files changed, 295 insertions(+), 386 deletions(-)
diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am
index 6cceca8a78..79677ce36f 100644
--- a/iocore/cache/Makefile.am
+++ b/iocore/cache/Makefile.am
@@ -105,6 +105,7 @@ test_LDADD = \
$(top_builddir)/lib/fastlz/libfastlz.a \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/src/tscpp/util/libtscpputil.la \
+ $(top_builddir)/mgmt/rpc/libjsonrpc_protocol.la \
@SWOC_LIBS@ \
@HWLOC_LIBS@ \
@LIBPCRE@ \
diff --git a/iocore/cache/test/stub.cc b/iocore/cache/test/stub.cc
index e4abeb1a20..eee82395e4 100644
--- a/iocore/cache/test/stub.cc
+++ b/iocore/cache/test/stub.cc
@@ -21,23 +21,10 @@
limitations under the License.
*/
-#include <string_view>
-
-#include "HttpSessionManager.h"
-#include "HttpBodyFactory.h"
-#include "DiagsConfig.h"
-#include "ts/InkAPIPrivateIOCore.h"
-
#include "tscore/I_Version.h"
AppVersionInfo appVersionInfo;
-void
-initialize_thread_for_http_sessions(EThread *, int)
-{
- ink_assert(false);
-}
-
#include "api/InkAPIInternal.h"
void
APIHooks::append(INKContInternal *cont)
@@ -92,125 +79,11 @@ HttpHookState::getNext()
return nullptr;
}
-void
-ConfigUpdateCbTable::invoke(const char * /* name ATS_UNUSED */)
-{
- ink_release_assert(false);
-}
-
HttpAPIHooks *http_global_hooks = nullptr;
SslAPIHooks *ssl_hooks = nullptr;
LifecycleAPIHooks *lifecycle_hooks = nullptr;
ConfigUpdateCbTable *global_config_cbs = nullptr;
-void
-HostStatus::setHostStatus(const std::string_view name, const TSHostStatus status, const unsigned int down_time,
- const unsigned int reason)
-{
-}
-
-HostStatRec *
-HostStatus::getHostStatus(const std::string_view name)
-{
- return nullptr;
-}
-
-HostStatus::HostStatus() {}
-
-HostStatus::~HostStatus() {}
-
-void
-INKVConnInternal::do_io_close(int error)
-{
-}
-
-void
-INKVConnInternal::do_io_shutdown(ShutdownHowTo_t howto)
-{
-}
-
-VIO *
-INKVConnInternal::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
-{
- return nullptr;
-}
-
-VIO *
-INKVConnInternal::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
-{
- return nullptr;
-}
-
-void
-INKVConnInternal::destroy()
-{
-}
-
-void
-INKVConnInternal::free()
-{
-}
-
-void
-INKVConnInternal::clear()
-{
-}
-
-void
-INKVConnInternal::reenable(VIO * /* vio ATS_UNUSED */)
-{
-}
-
-bool
-INKVConnInternal::get_data(int id, void *data)
-{
- return false;
-}
-
-bool
-INKVConnInternal::set_data(int id, void *data)
-{
- return false;
-}
-
-void
-INKVConnInternal::do_io_transform(VConnection *vc)
-{
-}
-
-void
-INKContInternal::handle_event_count(int event)
-{
-}
-
-void
-INKVConnInternal::retry(unsigned int delay)
-{
-}
-
-INKContInternal::INKContInternal(TSEventFunc funcp, TSMutex mutexp) : DummyVConnection(reinterpret_cast<ProxyMutex *>(mutexp)) {}
-
-INKContInternal::INKContInternal() : DummyVConnection(nullptr) {}
-
-void
-INKContInternal::destroy()
-{
-}
-
-void
-INKContInternal::clear()
-{
-}
-
-void
-INKContInternal::free()
-{
-}
-
-INKVConnInternal::INKVConnInternal() : INKContInternal() {}
-
-INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp) : INKContInternal(funcp, mutexp) {}
-
#include "api/FetchSM.h"
ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
void
diff --git a/iocore/net/libinknet_stub.cc b/iocore/net/libinknet_stub.cc
index d836d7dbf9..1147395251 100644
--- a/iocore/net/libinknet_stub.cc
+++ b/iocore/net/libinknet_stub.cc
@@ -23,10 +23,6 @@
class EThread;
class Continuation;
-void
-initialize_thread_for_http_sessions(EThread *, int)
-{
-}
#include "P_UnixNet.h"
#include "P_DNSConnection.h"
@@ -107,12 +103,6 @@ APIHooks::head() const
return nullptr;
}
-void
-ConfigUpdateCbTable::invoke(const char * /* name ATS_UNUSED */)
-{
- ink_release_assert(false);
-}
-
#include "ControlMatcher.h"
char *
HttpRequestData::get_string()
diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am
index 2894e2327c..ef06e03df0 100644
--- a/proxy/http/Makefile.am
+++ b/proxy/http/Makefile.am
@@ -112,6 +112,7 @@ test_proxy_http_LDADD = \
$(top_builddir)/src/tscore/libtscore.a \
$(top_builddir)/src/api/libtsapicore.a \
$(top_builddir)/src/tscpp/util/libtscpputil.la \
+ $(top_builddir)/mgmt/rpc/libjsonrpc_protocol.la \
@SWOC_LIBS@ @HWLOC_LIBS@ \
@LIBCAP@ \
@YAMLCPP_LIBS@ \
@@ -126,6 +127,7 @@ test_PreWarm_LDFLAGS = $(AM_LDFLAGS) @YAMLCPP_LDFLAGS@
test_PreWarm_LDADD = \
$(top_builddir)/src/tscore/libtscore.a \
+ $(top_builddir)/mgmt/rpc/libjsonrpc_protocol.la \
@YAMLCPP_LIBS@
test_PreWarm_SOURCES = \
@@ -161,6 +163,7 @@ test_HttpTransact_LDADD = \
$(top_builddir)/src/tscore/libtscore.a \
$(top_builddir)/src/api/libtsapicore.a \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
+ $(top_builddir)/mgmt/rpc/libjsonrpc_protocol.la \
-lz -llzma -lcrypto -lresolv -lssl \
@LIBPCRE@ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBCAP@
diff --git a/proxy/http/unit_tests/CMakeLists.txt b/proxy/http/unit_tests/CMakeLists.txt
index 64cc7d3d1b..00dd11783d 100644
--- a/proxy/http/unit_tests/CMakeLists.txt
+++ b/proxy/http/unit_tests/CMakeLists.txt
@@ -41,6 +41,7 @@ target_link_libraries(test_http
ts::proxy
inkdns # transitive
ts::inknet
+ ts::jsonrpc_protocol
)
add_test(NAME test_http COMMAND $<TARGET_FILE:test_http>)
diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt
index 2180bd272d..edeb41a1d8 100644
--- a/src/api/CMakeLists.txt
+++ b/src/api/CMakeLists.txt
@@ -17,13 +17,18 @@
add_library(tsapi SHARED
InkAPI.cc
- InkContInternal.cc
InkIOCoreAPI.cc
)
add_library(ts::tsapi ALIAS tsapi)
target_link_libraries(tsapi PRIVATE ts::tscore)
-add_library(tsapicore STATIC Metrics.cc FetchSM.cc)
+add_library(tsapicore STATIC
+ Metrics.cc
+ ConfigUpdateCbTable.cc
+ InkContInternal.cc
+ InkVConnInternal.cc
+ FetchSM.cc
+)
add_library(ts::tsapicore ALIAS tsapicore)
target_link_libraries(tsapicore PRIVATE ts::tscore)
diff --git a/src/api/ConfigUpdateCbTable.cc b/src/api/ConfigUpdateCbTable.cc
new file mode 100644
index 0000000000..19f6dfa50e
--- /dev/null
+++ b/src/api/ConfigUpdateCbTable.cc
@@ -0,0 +1,64 @@
+/** @file
+
+ Internal SDK stuff
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#include "api/InkAPIInternal.h"
+
+ConfigUpdateCbTable::ConfigUpdateCbTable() {}
+
+ConfigUpdateCbTable::~ConfigUpdateCbTable() {}
+
+void
+ConfigUpdateCbTable::insert(INKContInternal *contp, const char *name)
+{
+ if (contp && name) {
+ cb_table.emplace(name, contp);
+ }
+}
+
+void
+ConfigUpdateCbTable::invoke(const char *name)
+{
+ INKContInternal *contp;
+
+ if (name != nullptr) {
+ if (strcmp(name, "*") == 0) {
+ for (auto &&it : cb_table) {
+ contp = it.second;
+ ink_assert(contp != nullptr);
+ invoke(contp);
+ }
+ } else {
+ if (auto it = cb_table.find(name); it != cb_table.end()) {
+ contp = it->second;
+ ink_assert(contp != nullptr);
+ invoke(contp);
+ }
+ }
+ }
+}
+
+void
+ConfigUpdateCbTable::invoke(INKContInternal *contp)
+{
+ eventProcessor.schedule_imm(new ConfigUpdateCallback(contp), ET_TASK);
+}
diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index bb2e72c9a5..ebb9b26c93 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -404,7 +404,7 @@ static int ts_patch_version = 0;
static ClassAllocator<APIHook> apiHookAllocator("apiHookAllocator");
extern ClassAllocator<INKContInternal> INKContAllocator;
-static ClassAllocator<INKVConnInternal> INKVConnAllocator("INKVConnAllocator");
+extern ClassAllocator<INKVConnInternal> INKVConnAllocator;
static ClassAllocator<MIMEFieldSDKHandle> mHandleAllocator("MIMEFieldSDKHandle");
////////////////////////////////////////////////////////////////////
@@ -1042,204 +1042,6 @@ FileImpl::fgets(char *buf, size_t length)
return buf;
}
-////////////////////////////////////////////////////////////////////
-//
-// INKContInternal
-//
-////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////
-//
-// INKVConnInternal
-//
-////////////////////////////////////////////////////////////////////
-
-INKVConnInternal::INKVConnInternal() : INKContInternal(), m_read_vio(), m_write_vio(), m_output_vc(nullptr)
-{
- m_closed = 0;
-}
-
-INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp)
- : INKContInternal(funcp, mutexp), m_read_vio(), m_write_vio(), m_output_vc(nullptr)
-{
- m_closed = 0;
-}
-
-void
-INKVConnInternal::clear()
-{
- m_read_vio.set_continuation(nullptr);
- m_write_vio.set_continuation(nullptr);
- INKContInternal::clear();
-}
-
-void
-INKVConnInternal::free()
-{
- clear();
- this->mutex.clear();
- m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
- THREAD_FREE(this, INKVConnAllocator, this_thread());
-}
-
-void
-INKVConnInternal::destroy()
-{
- if (m_free_magic == INKCONT_INTERN_MAGIC_DEAD) {
- ink_release_assert(!"Plugin tries to use a vconnection which is deleted");
- }
-
- m_deleted = 1;
- if (m_deletable) {
- free();
- }
-}
-
-VIO *
-INKVConnInternal::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
-{
- m_read_vio.buffer.writer_for(buf);
- m_read_vio.op = VIO::READ;
- m_read_vio.set_continuation(c);
- m_read_vio.nbytes = nbytes;
- m_read_vio.ndone = 0;
- m_read_vio.vc_server = this;
-
- if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
- ink_assert(!"not reached");
- }
- eventProcessor.schedule_imm(this, ET_NET);
-
- return &m_read_vio;
-}
-
-VIO *
-INKVConnInternal::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
-{
- ink_assert(!owner);
- m_write_vio.buffer.reader_for(buf);
- m_write_vio.op = VIO::WRITE;
- m_write_vio.set_continuation(c);
- m_write_vio.nbytes = nbytes;
- m_write_vio.ndone = 0;
- m_write_vio.vc_server = this;
-
- if (m_write_vio.buffer.reader()->read_avail() > 0) {
- if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
- ink_assert(!"not reached");
- }
- eventProcessor.schedule_imm(this, ET_NET);
- }
-
- return &m_write_vio;
-}
-
-void
-INKVConnInternal::do_io_transform(VConnection *vc)
-{
- m_output_vc = vc;
-}
-
-void
-INKVConnInternal::do_io_close(int error)
-{
- if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
- ink_assert(!"not reached");
- }
-
- INK_WRITE_MEMORY_BARRIER;
-
- if (error != -1) {
- lerrno = error;
- m_closed = TS_VC_CLOSE_ABORT;
- } else {
- m_closed = TS_VC_CLOSE_NORMAL;
- }
-
- m_read_vio.op = VIO::NONE;
- m_read_vio.buffer.clear();
-
- m_write_vio.op = VIO::NONE;
- m_write_vio.buffer.clear();
-
- if (m_output_vc) {
- m_output_vc->do_io_close(error);
- m_output_vc = nullptr;
- }
-
- eventProcessor.schedule_imm(this, ET_NET);
-}
-
-void
-INKVConnInternal::do_io_shutdown(ShutdownHowTo_t howto)
-{
- if ((howto == IO_SHUTDOWN_READ) || (howto == IO_SHUTDOWN_READWRITE)) {
- m_read_vio.op = VIO::NONE;
- m_read_vio.buffer.clear();
- }
-
- if ((howto == IO_SHUTDOWN_WRITE) || (howto == IO_SHUTDOWN_READWRITE)) {
- m_write_vio.op = VIO::NONE;
- m_write_vio.buffer.clear();
- }
-
- if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
- ink_assert(!"not reached");
- }
- eventProcessor.schedule_imm(this, ET_NET);
-}
-
-void
-INKVConnInternal::reenable(VIO * /* vio ATS_UNUSED */)
-{
- if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
- ink_assert(!"not reached");
- }
- eventProcessor.schedule_imm(this, ET_NET);
-}
-
-void
-INKVConnInternal::retry(unsigned int delay)
-{
- if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
- ink_assert(!"not reached");
- }
- mutex->thread_holding->schedule_in(this, HRTIME_MSECONDS(delay));
-}
-
-bool
-INKVConnInternal::get_data(int id, void *data)
-{
- switch (id) {
- case TS_API_DATA_READ_VIO:
- *((TSVIO *)data) = reinterpret_cast<TSVIO>(&m_read_vio);
- return true;
- case TS_API_DATA_WRITE_VIO:
- *((TSVIO *)data) = reinterpret_cast<TSVIO>(&m_write_vio);
- return true;
- case TS_API_DATA_OUTPUT_VC:
- *((TSVConn *)data) = reinterpret_cast<TSVConn>(m_output_vc);
- return true;
- case TS_API_DATA_CLOSED:
- *((int *)data) = m_closed;
- return true;
- default:
- return INKContInternal::get_data(id, data);
- }
-}
-
-bool
-INKVConnInternal::set_data(int id, void *data)
-{
- switch (id) {
- case TS_API_DATA_OUTPUT_VC:
- m_output_vc = (VConnection *)data;
- return true;
- default:
- return INKContInternal::set_data(id, data);
- }
-}
-
////////////////////////////////////////////////////////////////////
//
// APIHook, APIHooks, HttpAPIHooks, HttpHookState
@@ -1392,52 +1194,6 @@ HttpHookState::Scope::clear()
_p = _c = nullptr;
}
-////////////////////////////////////////////////////////////////////
-//
-// ConfigUpdateCbTable
-//
-////////////////////////////////////////////////////////////////////
-
-ConfigUpdateCbTable::ConfigUpdateCbTable() {}
-
-ConfigUpdateCbTable::~ConfigUpdateCbTable() {}
-
-void
-ConfigUpdateCbTable::insert(INKContInternal *contp, const char *name)
-{
- if (contp && name) {
- cb_table.emplace(name, contp);
- }
-}
-
-void
-ConfigUpdateCbTable::invoke(const char *name)
-{
- INKContInternal *contp;
-
- if (name != nullptr) {
- if (strcmp(name, "*") == 0) {
- for (auto &&it : cb_table) {
- contp = it.second;
- ink_assert(contp != nullptr);
- invoke(contp);
- }
- } else {
- if (auto it = cb_table.find(name); it != cb_table.end()) {
- contp = it->second;
- ink_assert(contp != nullptr);
- invoke(contp);
- }
- }
- }
-}
-
-void
-ConfigUpdateCbTable::invoke(INKContInternal *contp)
-{
- eventProcessor.schedule_imm(new ConfigUpdateCallback(contp), ET_TASK);
-}
-
////////////////////////////////////////////////////////////////////
//
// api_init
diff --git a/src/api/InkVConnInternal.cc b/src/api/InkVConnInternal.cc
new file mode 100644
index 0000000000..00b4e80be4
--- /dev/null
+++ b/src/api/InkVConnInternal.cc
@@ -0,0 +1,213 @@
+/** @file
+
+ Internal SDK stuff
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#include "ts/apidefs.h"
+#include "ts/InkAPIPrivateIOCore.h"
+
+ClassAllocator<INKVConnInternal> INKVConnAllocator("INKVConnAllocator");
+
+INKVConnInternal::INKVConnInternal() : INKContInternal(), m_read_vio(), m_write_vio(), m_output_vc(nullptr)
+{
+ m_closed = 0;
+}
+
+INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp)
+ : INKContInternal(funcp, mutexp), m_read_vio(), m_write_vio(), m_output_vc(nullptr)
+{
+ m_closed = 0;
+}
+
+void
+INKVConnInternal::clear()
+{
+ m_read_vio.set_continuation(nullptr);
+ m_write_vio.set_continuation(nullptr);
+ INKContInternal::clear();
+}
+
+void
+INKVConnInternal::free()
+{
+ clear();
+ this->mutex.clear();
+ m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
+ THREAD_FREE(this, INKVConnAllocator, this_thread());
+}
+
+void
+INKVConnInternal::destroy()
+{
+ if (m_free_magic == INKCONT_INTERN_MAGIC_DEAD) {
+ ink_release_assert(!"Plugin tries to use a vconnection which is deleted");
+ }
+
+ m_deleted = 1;
+ if (m_deletable) {
+ free();
+ }
+}
+
+VIO *
+INKVConnInternal::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
+{
+ m_read_vio.buffer.writer_for(buf);
+ m_read_vio.op = VIO::READ;
+ m_read_vio.set_continuation(c);
+ m_read_vio.nbytes = nbytes;
+ m_read_vio.ndone = 0;
+ m_read_vio.vc_server = this;
+
+ if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
+ ink_assert(!"not reached");
+ }
+ eventProcessor.schedule_imm(this, ET_NET);
+
+ return &m_read_vio;
+}
+
+VIO *
+INKVConnInternal::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
+{
+ ink_assert(!owner);
+ m_write_vio.buffer.reader_for(buf);
+ m_write_vio.op = VIO::WRITE;
+ m_write_vio.set_continuation(c);
+ m_write_vio.nbytes = nbytes;
+ m_write_vio.ndone = 0;
+ m_write_vio.vc_server = this;
+
+ if (m_write_vio.buffer.reader()->read_avail() > 0) {
+ if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
+ ink_assert(!"not reached");
+ }
+ eventProcessor.schedule_imm(this, ET_NET);
+ }
+
+ return &m_write_vio;
+}
+
+void
+INKVConnInternal::do_io_transform(VConnection *vc)
+{
+ m_output_vc = vc;
+}
+
+void
+INKVConnInternal::do_io_close(int error)
+{
+ if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
+ ink_assert(!"not reached");
+ }
+
+ INK_WRITE_MEMORY_BARRIER;
+
+ if (error != -1) {
+ lerrno = error;
+ m_closed = TS_VC_CLOSE_ABORT;
+ } else {
+ m_closed = TS_VC_CLOSE_NORMAL;
+ }
+
+ m_read_vio.op = VIO::NONE;
+ m_read_vio.buffer.clear();
+
+ m_write_vio.op = VIO::NONE;
+ m_write_vio.buffer.clear();
+
+ if (m_output_vc) {
+ m_output_vc->do_io_close(error);
+ m_output_vc = nullptr;
+ }
+
+ eventProcessor.schedule_imm(this, ET_NET);
+}
+
+void
+INKVConnInternal::do_io_shutdown(ShutdownHowTo_t howto)
+{
+ if ((howto == IO_SHUTDOWN_READ) || (howto == IO_SHUTDOWN_READWRITE)) {
+ m_read_vio.op = VIO::NONE;
+ m_read_vio.buffer.clear();
+ }
+
+ if ((howto == IO_SHUTDOWN_WRITE) || (howto == IO_SHUTDOWN_READWRITE)) {
+ m_write_vio.op = VIO::NONE;
+ m_write_vio.buffer.clear();
+ }
+
+ if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
+ ink_assert(!"not reached");
+ }
+ eventProcessor.schedule_imm(this, ET_NET);
+}
+
+void
+INKVConnInternal::reenable(VIO * /* vio ATS_UNUSED */)
+{
+ if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
+ ink_assert(!"not reached");
+ }
+ eventProcessor.schedule_imm(this, ET_NET);
+}
+
+void
+INKVConnInternal::retry(unsigned int delay)
+{
+ if (ink_atomic_increment((int *)&m_event_count, 1) < 0) {
+ ink_assert(!"not reached");
+ }
+ mutex->thread_holding->schedule_in(this, HRTIME_MSECONDS(delay));
+}
+
+bool
+INKVConnInternal::get_data(int id, void *data)
+{
+ switch (id) {
+ case TS_API_DATA_READ_VIO:
+ *((TSVIO *)data) = reinterpret_cast<TSVIO>(&m_read_vio);
+ return true;
+ case TS_API_DATA_WRITE_VIO:
+ *((TSVIO *)data) = reinterpret_cast<TSVIO>(&m_write_vio);
+ return true;
+ case TS_API_DATA_OUTPUT_VC:
+ *((TSVConn *)data) = reinterpret_cast<TSVConn>(m_output_vc);
+ return true;
+ case TS_API_DATA_CLOSED:
+ *((int *)data) = m_closed;
+ return true;
+ default:
+ return INKContInternal::get_data(id, data);
+ }
+}
+
+bool
+INKVConnInternal::set_data(int id, void *data)
+{
+ switch (id) {
+ case TS_API_DATA_OUTPUT_VC:
+ m_output_vc = (VConnection *)data;
+ return true;
+ default:
+ return INKContInternal::set_data(id, data);
+ }
+}
diff --git a/src/api/Makefile.am b/src/api/Makefile.am
index 5bedece5e6..f165c6024e 100644
--- a/src/api/Makefile.am
+++ b/src/api/Makefile.am
@@ -49,7 +49,6 @@ libtsapi_la_LIBADD = \
libtsapi_la_SOURCES = \
InkAPI.cc \
- InkContInternal.cc \
InkIOCoreAPI.cc
if BUILD_TESTS
@@ -61,6 +60,9 @@ endif
libtsapicore_a_SOURCES = \
Metrics.cc \
+ ConfigUpdateCbTable.cc \
+ InkContInternal.cc \
+ InkVConnInternal.cc \
FetchSM.cc
test_Metrics_SOURCES = test_Metrics.cc
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 3c05384fae..369c5a3e3c 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -23,6 +23,7 @@ include_directories(
)
link_libraries(
+ inkcache
http
http_remap
http2
@@ -42,7 +43,6 @@ link_libraries(
hdrs
http_remap
logging
- inkcache
fastlz
aio
records
@@ -55,6 +55,7 @@ link_libraries(
yaml-cpp
libswoc
catch2::catch2
+ jsonrpc_protocol
)
if (TS_USE_LINUX_IO_URING)
link_libraries(inkuring uring)