You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/02/02 05:46:09 UTC
[trafficserver] branch quic-latest updated: initialize `opts` to
create udp connection with correct local addr
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new a0beeed initialize `opts` to create udp connection with correct local addr
a0beeed is described below
commit a0beeed6a9a7cf52e737191b75728c81ed05beae
Author: scw00 <sc...@apache.org>
AuthorDate: Fri Feb 2 08:13:46 2018 +0800
initialize `opts` to create udp connection with correct local addr
---
cmd/traffic_quic/quic_client.cc | 6 ++++--
iocore/net/QUICNetProcessor.cc | 24 +++++++++++-------------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/cmd/traffic_quic/quic_client.cc b/cmd/traffic_quic/quic_client.cc
index ec53e04..c42410c 100644
--- a/cmd/traffic_quic/quic_client.cc
+++ b/cmd/traffic_quic/quic_client.cc
@@ -49,8 +49,10 @@ QUICClient::start()
for (struct addrinfo *info = this->_remote_addr_info; info != nullptr; info = info->ai_next) {
NetVCOptions opt;
- opt.ip_proto = NetVCOptions::USE_UDP;
- opt.ip_family = info->ai_family;
+ opt.ip_proto = NetVCOptions::USE_UDP;
+ opt.ip_family = info->ai_family;
+ opt.socket_recv_bufsize = 1048576;
+ opt.socket_send_bufsize = 1048576;
SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
diff --git a/iocore/net/QUICNetProcessor.cc b/iocore/net/QUICNetProcessor.cc
index cfb3b9e..8dc335f 100644
--- a/iocore/net/QUICNetProcessor.cc
+++ b/iocore/net/QUICNetProcessor.cc
@@ -120,18 +120,21 @@ Action *
QUICNetProcessor::connect_re(Continuation *cont, sockaddr const *remote_addr, NetVCOptions *opt)
{
Debug("quic_ps", "connect to server");
-
EThread *t = cont->mutex->thread_holding;
ink_assert(t);
+ QUICNetVConnection *vc = static_cast<QUICNetVConnection *>(this->allocate_vc(t));
- sockaddr local_addr;
- int local_addr_len;
- local_addr.sa_family = remote_addr->sa_family;
+ if (opt) {
+ vc->options = *opt;
+ } else {
+ opt = &vc->options;
+ }
int fd;
Action *status;
- bool result = udpNet.CreateUDPSocket(&fd, remote_addr, &local_addr, &local_addr_len, &status, 1048576, 1048576);
+ bool result = udpNet.CreateUDPSocket(&fd, remote_addr, &status, *opt);
if (!result) {
+ vc->free(t);
return status;
}
@@ -140,7 +143,9 @@ QUICNetProcessor::connect_re(Continuation *cont, sockaddr const *remote_addr, Ne
Debug("quic_ps", "con=%p fd=%d", con, fd);
QUICPacketHandlerOut *packet_handler = new QUICPacketHandlerOut();
- con->setBinding(reinterpret_cast<sockaddr const *>(&local_addr));
+ if (opt->local_ip.isValid()) {
+ con->setBinding(opt->local_ip, opt->local_port);
+ }
con->bindToThread(packet_handler);
PollCont *pc = get_UDPPollCont(con->ethread);
@@ -155,16 +160,9 @@ QUICNetProcessor::connect_re(Continuation *cont, sockaddr const *remote_addr, Ne
// Setup QUICNetVConnection
QUICConnectionId cid;
cid.randomize();
- QUICNetVConnection *vc = static_cast<QUICNetVConnection *>(this->allocate_vc(t));
vc->init(cid, con, packet_handler);
packet_handler->init(vc);
- if (opt) {
- vc->options = *opt;
- } else {
- opt = &vc->options;
- }
-
// Connection ID will be changed
vc->id = net_next_connection_number();
vc->set_context(NET_VCONNECTION_OUT);
--
To stop receiving notification emails like this one, please contact
masaori@apache.org.