Quic pollcont, Reuse the NetHandler for UDP packet#3056
Quic pollcont, Reuse the NetHandler for UDP packet#3056scw00 merged 6 commits intoapache:quic-latestfrom
Conversation
|
I could build this PR and complete handshake with ngtcp2 :) There're some TODOs, but this looks good. |
|
I got this crash when I try our quic client. |
iocore/net/QUICNet.cc
Outdated
| NetHandler *nh = get_NetHandler(this->mutex->thread_holding); | ||
|
|
||
| // Process the ASLL | ||
| SList(UDPPacketInternal, alink) aq(inQueue.popall()); |
There was a problem hiding this comment.
do you need both aq and result?
There was a problem hiding this comment.
result is used to make sure all packet (which we pop from result) was in original order. Since template <class C, class L = typename C::Link_link> class SLL doesn't have dequeue method.
iocore/net/QUICNet.cc
Outdated
|
|
||
| new ((ink_dummy_for_new *)quicpc) QUICPollCont(thread->mutex, nh); | ||
|
|
||
| thread->schedule_every(quicpc, -9); |
There was a problem hiding this comment.
I just copy the line from initialize_thread_for_udp_net(). Please update both of them. :-)
| if (vc != nullptr) { | ||
| int isin = ink_atomic_swap(&vc->read.in_enabled_list, 1); | ||
| if (!isin) { | ||
| nh->read_enable_list.push(vc); |
There was a problem hiding this comment.
do we need to hold the lock to modify the nh?
There was a problem hiding this comment.
read_enable_list is an atomic queue. so we don't need to hold the nh lock.
iocore/net/P_UnixNet.h
Outdated
| TS_INLINE int | ||
| EventIO::refresh(int e) | ||
| { | ||
| if (fd == NO_FD) { |
There was a problem hiding this comment.
no sure about this. can we figure out a better way?
There was a problem hiding this comment.
EventIO is a interface for polling system. Because the QUIC Connection does not supported by polling system, I left the hack code here. I can add a new member within EventIO to indicate the situation.
| @@ -575,8 +575,15 @@ EventIO::start(EventLoop l, NetAccept *vc, int events) | |||
| TS_INLINE int | |||
| EventIO::start(EventLoop l, UnixNetVConnection *vc, int events) | |||
There was a problem hiding this comment.
here, http://people.apache.org/~oknet/quic_arch.2017112813.png, pollCont is meant to call back UnixUdpConnection but here it's call back to UnixNetVConnection?
There was a problem hiding this comment.
Yes, but currently QCon doesn't inherit from Connection. So we just leave this here.
There was a problem hiding this comment.
And UnixUDPConnection is used to recv socket, it is running in UDP thread.
bcca475 to
3b18ea3
Compare
iocore/net/UnixUDPNet.cc
Outdated
| g_udp_numSendRetries = g_udp_numSendRetries < 0 ? 0 : g_udp_numSendRetries; | ||
|
|
||
| thread->schedule_every(get_UDPPollCont(thread), -9); | ||
| thread->schedule_every(get_UDPPollCont(thread), -UDP_PERIOD); |
| free(t); | ||
| return EVENT_DONE; | ||
| } | ||
| this->read.enabled = 1; |
There was a problem hiding this comment.
This is a hack now, because no one calls do_io_xxx of QUICNetVC.
Can you add a comment here, so we can complete it later.
| if ((res = nh->startIO(this)) < 0) { | ||
| // FIXME: startIO only return 0 now! what should we do if it failed ? | ||
| } | ||
|
|
There was a problem hiding this comment.
Please add this->read.enabled = 1; at here.
iocore/net/QUICNetVConnection.cc
Outdated
| this->_packet_handler = packet_handler; | ||
| this->_original_quic_connection_id = original_cid; | ||
| this->_quic_connection_id.randomize(); | ||
| this->ep.syscall = false; |
There was a problem hiding this comment.
Move to QUICNetProcessor::allocate_vc(EThread *t) ?
|
Where are packets in |
|
longInQueue and shortInQueue are useless currently ! It is going to be used for reordering the rtt0 first packet and handshake packet . |
iocore/net/QUICPacketHandler.cc
Outdated
| } | ||
|
|
||
| // Push the packet into QUICPollCont | ||
| udp_packet->data.ptr = vc; |
There was a problem hiding this comment.
Hmm, I'm not so thrilled with having this data member. Do we have other options?
iocore/net/QUICNet.cc
Outdated
|
|
||
| new ((ink_dummy_for_new *)quicpc) QUICPollCont(thread->mutex, nh); | ||
|
|
||
| thread->schedule_every(quicpc, -UDP_PERIOD); |
There was a problem hiding this comment.
HRTIME_MSECONDS?
Why are these negative value?
There was a problem hiding this comment.
negative value means quic pc should be inserted into the priority queue. It will be triggered every loop in evensystem.
There was a problem hiding this comment.
@maskit yes, the same for DNS, no very intuitive though.
|
Based on @maskit 's suggestion. I introduced a new struct to packet the UDPPacket and QVC, and removed the hack in UDPPacket. |
|
Looks good to me. Please remove WIP label when it's ready. (I assume some of comments from oknet have to be addressed.) |
oknet
left a comment
There was a problem hiding this comment.
Next, make the QUICNetVC inherits from RefCountObj, increase the reference count once a QUICPollEvent is created.

Base on @oknet design.
We create QUICPollCont to dispatch UDPacket to different qvc. And NetHandler will callback to qvc handler to process packet.