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
2 changes: 2 additions & 0 deletions iocore/net/P_UDPNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ extern UDPNetProcessorInternal udpNetInternal;
#define SLOT_TIME HRTIME_MSECONDS(SLOT_TIME_MSEC)
#define N_SLOTS 2048

constexpr int UDP_PERIOD = 9;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we want to make this configurable? Under what conditions would I want to change it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Do not change this period unless you really know what happen after changing. It might callback twice per loop for one continuation in wrong configuration. So I give a constexpr here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to changing this period you might need to reconsider all of the continuations's order in udp's negative queue.


class PacketQueue
{
public:
Expand Down
20 changes: 20 additions & 0 deletions iocore/net/P_UnixNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct EventIO {
int events = 0;
#endif
EventLoop event_loop = nullptr;
bool syscall = true;
int type = 0;
union {
Continuation *c;
Expand Down Expand Up @@ -556,6 +557,10 @@ EventIO::start(EventLoop l, UnixUDPConnection *vc, int events)
TS_INLINE int
EventIO::close()
{
if (!this->syscall) {
return 0;
}

stop();
switch (type) {
default:
Expand All @@ -577,6 +582,10 @@ EventIO::close()
TS_INLINE int
EventIO::start(EventLoop l, int afd, Continuation *c, int e)
{
if (!this->syscall) {
return 0;
}

data.c = c;
fd = afd;
event_loop = l;
Expand Down Expand Up @@ -612,6 +621,10 @@ EventIO::start(EventLoop l, int afd, Continuation *c, int e)
TS_INLINE int
EventIO::modify(int e)
{
if (!this->syscall) {
return 0;
}

ink_assert(event_loop);
#if TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER)
struct epoll_event ev;
Expand Down Expand Up @@ -691,6 +704,10 @@ EventIO::modify(int e)
TS_INLINE int
EventIO::refresh(int e)
{
if (!this->syscall) {
return 0;
}

ink_assert(event_loop);
#if TS_USE_KQUEUE && defined(USE_EDGE_TRIGGER)
e = e & events;
Expand Down Expand Up @@ -732,6 +749,9 @@ EventIO::refresh(int e)
TS_INLINE int
EventIO::stop()
{
if (!this->syscall) {
return 0;
}
if (event_loop) {
int retval = 0;
#if TS_USE_EPOLL
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/UnixUDPNet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ UDPNetHandler::startNetEvent(int event, Event *e)
(void)event;
SET_HANDLER((UDPNetContHandler)&UDPNetHandler::mainNetEvent);
trigger_event = e;
e->schedule_every(-HRTIME_MSECONDS(9));
e->schedule_every(-HRTIME_MSECONDS(UDP_PERIOD));
return EVENT_CONT;
}

Expand Down