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
1 change: 1 addition & 0 deletions iocore/net/I_UDPNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
class UDPNetProcessor : public Processor
{
public:
virtual EventType register_event_type() = 0;
int start(int n_upd_threads, size_t stacksize) override = 0;

// this function was internal initially.. this is required for public and
Expand Down
5 changes: 4 additions & 1 deletion iocore/net/P_UDPNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ static inline PollCont *get_UDPPollCont(EThread *);

class UDPNetHandler;

struct UDPNetProcessorInternal : public UDPNetProcessor {
class UDPNetProcessorInternal : public UDPNetProcessor
{
public:
EventType register_event_type() override;
int start(int n_udp_threads, size_t stacksize) override;
void udp_read_from_net(UDPNetHandler *nh, UDPConnection *uc);
int udp_callback(UDPNetHandler *nh, UDPConnection *uc, EThread *thread);
Expand Down
8 changes: 7 additions & 1 deletion iocore/net/UnixUDPNet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ initialize_thread_for_udp_net(EThread *thread)
#endif
}

EventType
UDPNetProcessorInternal::register_event_type()
{
ET_UDP = eventProcessor.register_event_type("ET_UDP");
return ET_UDP;
}

int
UDPNetProcessorInternal::start(int n_upd_threads, size_t stacksize)
{
Expand All @@ -121,7 +128,6 @@ UDPNetProcessorInternal::start(int n_upd_threads, size_t stacksize)
pollCont_offset = eventProcessor.allocate(sizeof(PollCont));
udpNetHandler_offset = eventProcessor.allocate(sizeof(UDPNetHandler));

ET_UDP = eventProcessor.register_event_type("ET_UDP");
eventProcessor.schedule_spawn(&initialize_thread_for_udp_net, ET_UDP);
eventProcessor.spawn_event_threads(ET_UDP, n_upd_threads, stacksize);

Expand Down
6 changes: 6 additions & 0 deletions proxy/shared/UglyLogStubs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ int fds_limit = 8000;

class FakeUDPNetProcessor : public UDPNetProcessor
{
EventType
register_event_type() override
{
return 999;
}

int
start(int, size_t) override
{
Expand Down
2 changes: 2 additions & 0 deletions src/traffic_server/traffic_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,8 @@ main(int /* argc ATS_UNUSED */, const char **argv)
if (!num_of_udp_threads) {
REC_ReadConfigInteger(num_of_udp_threads, "proxy.config.udp.threads");
}

udpNet.register_event_type();
if (num_of_udp_threads) {
udpNet.start(num_of_udp_threads, stacksize);
eventProcessor.thread_group[ET_UDP]._afterStartCallback = init_HttpProxyServer;
Expand Down