Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions iocore/net/AcceptOptions.cc

This file was deleted.

42 changes: 17 additions & 25 deletions iocore/net/AcceptOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,52 +25,50 @@
#pragma once

#include "tscore/ink_inet.h"

#include "I_Event.h"

struct AcceptOptions {
using self = AcceptOptions; ///< Self reference type.

/// Port on which to listen.
/// 0 => don't care, which is useful if the socket is already bound.
int local_port;
int local_port = 0;
/// Local address to bind for accept.
/// If not set -> any address.
IpAddr local_ip;
/// IP address family.
/// @note Ignored if an explicit incoming address is set in the
/// the configuration (@c local_ip). If neither is set IPv4 is used.
int ip_family;
int ip_family = AF_INET;
/// Should we use accept threads? If so, how many?
int accept_threads;
/// Event type to generate on accept.
EventType etype;
int accept_threads = -1;
/** If @c true, the continuation is called back with
@c NET_EVENT_ACCEPT_SUCCEED
or @c NET_EVENT_ACCEPT_FAILED on success and failure resp.
*/

bool localhost_only;
bool localhost_only = false;
/// Are frequent accepts expected?
/// Default: @c false.
bool frequent_accept;
bool frequent_accept = true;

/// Socket receive buffer size.
/// 0 => OS default.
int recv_bufsize;
int recv_bufsize = 0;
/// Socket transmit buffer size.
/// 0 => OS default.
int send_bufsize;
int send_bufsize = 0;
/// defer accept for @c sockopt.
/// 0 => OS default.
int defer_accept;
int defer_accept = 0;
/// Socket options for @c sockopt.
/// 0 => do not set options.
uint32_t sockopt_flags;
uint32_t packet_mark;
uint32_t packet_tos;
uint32_t packet_notsent_lowat;
uint32_t sockopt_flags = 0;
uint32_t packet_mark = 0;
uint32_t packet_tos = 0;
uint32_t packet_notsent_lowat = 0;

int tfo_queue_length;
int tfo_queue_length = 0;

/** Transparency on client (user agent) connection.
@internal This is irrelevant at a socket level (since inbound
Expand All @@ -79,20 +77,14 @@ struct AcceptOptions {
whether the inbound (client / user agent) connection is
transparent.
*/
bool f_inbound_transparent;
bool f_inbound_transparent = false;

/** MPTCP enabled on listener.
@internal For logging and metrics purposes to know whether the
listener enabled MPTCP or not.
*/
bool f_mptcp;
bool f_mptcp = false;

/// Proxy Protocol enabled
bool f_proxy_protocol;

/// Default constructor.
/// Instance is constructed with default values.
AcceptOptions() { this->reset(); }
/// Reset all values to defaults.
self &reset();
bool f_proxy_protocol = false;
};
1 change: 0 additions & 1 deletion iocore/net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


add_library(inknet STATIC
AcceptOptions.cc
ALPNSupport.cc
AsyncSignalEventIO.cc
BIO_fastopen.cc
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/Connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Server::setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions

ink_assert(fd != NO_FD);

if (opt.etype == ET_NET && opt.defer_accept > 0) {
if (opt.defer_accept > 0) {
http_accept_filter = true;
add_http_filter(fd);
}
Expand Down
1 change: 0 additions & 1 deletion iocore/net/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ test_libinknet_LDADD += \
endif

libinknet_a_SOURCES = \
AcceptOptions.cc \
AcceptOptions.h \
ALPNSupport.cc \
AsyncSignalEventIO.cc \
Expand Down
13 changes: 6 additions & 7 deletions iocore/net/UnixNetAccept.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ net_accept(NetAccept *na, void *ep, bool blockable)

EThread *t;
NetHandler *h;
if (e->ethread->is_event_type(na->opt.etype)) {
if (e->ethread->is_event_type(ET_NET)) {
t = e->ethread;
h = get_NetHandler(t);
// Assign NetHandler->mutex to NetVC
Expand All @@ -115,7 +115,7 @@ net_accept(NetAccept *na, void *ep, bool blockable)
vc->handleEvent(EVENT_NONE, e);
}
} else {
t = eventProcessor.assign_thread(na->opt.etype);
t = eventProcessor.assign_thread(ET_NET);
h = get_NetHandler(t);
// Assign NetHandler->mutex to NetVC
vc->mutex = h->mutex;
Expand Down Expand Up @@ -178,7 +178,7 @@ void
NetAccept::init_accept(EThread *t)
{
if (!t) {
t = eventProcessor.assign_thread(opt.etype);
t = eventProcessor.assign_thread(ET_NET);
}

if (!action_->continuation->mutex) {
Expand Down Expand Up @@ -227,7 +227,6 @@ NetAccept::init_accept_per_thread()
int i, n;
int listen_per_thread = 0;

ink_assert(opt.etype >= 0);
REC_ReadConfigInteger(listen_per_thread, "proxy.config.exec_thread.listen");

if (listen_per_thread == 0) {
Expand All @@ -238,11 +237,11 @@ NetAccept::init_accept_per_thread()
}

SET_HANDLER(&NetAccept::accept_per_thread);
n = eventProcessor.thread_group[opt.etype]._count;
n = eventProcessor.thread_group[ET_NET]._count;

for (i = 0; i < n; i++) {
NetAccept *a = (i < n - 1) ? clone() : this;
EThread *t = eventProcessor.thread_group[opt.etype]._thread[i];
EThread *t = eventProcessor.thread_group[ET_NET]._thread[i];
a->mutex = get_NetHandler(t)->mutex;
t->schedule_imm(a);
}
Expand Down Expand Up @@ -364,7 +363,7 @@ NetAccept::do_blocking_accept(EThread *t)
#endif
SET_CONTINUATION_HANDLER(vc, &UnixNetVConnection::acceptEvent);

EThread *localt = eventProcessor.assign_thread(opt.etype);
EThread *localt = eventProcessor.assign_thread(ET_NET);
NetHandler *h = get_NetHandler(localt);
// Assign NetHandler->mutex to NetVC
vc->mutex = h->mutex;
Expand Down