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 2017/08/18 05:49:56 UTC

[trafficserver] 03/05: Fix "Invalid argument" error on sending UDP packet

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

commit 5fe89243e0d21d4cf0a1c268cb85ec7840f0198a
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Aug 18 14:35:57 2017 +0900

    Fix "Invalid argument" error on sending UDP packet
---
 iocore/net/UnixUDPNet.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index c6d4602..ee2c591 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -780,7 +780,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* pktLen ATS_UNUSED */)
   msg.msg_flags      = 0;
 #endif
   msg.msg_name    = (caddr_t)&p->to.sa;
-  msg.msg_namelen = sizeof(p->to.sa);
+  msg.msg_namelen = ats_ip_size(p->to);
   iov_len         = 0;
 
   for (IOBufferBlock *b = p->chain.get(); b != nullptr; b = b->next.get()) {
@@ -798,6 +798,10 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* pktLen ATS_UNUSED */)
     n = ::sendmsg(p->conn->getFd(), &msg, 0);
     if ((n >= 0) || ((n < 0) && (errno != EAGAIN))) {
       // send succeeded or some random error happened.
+      if (n < 0) {
+        Debug("udp-send", "Error: %s (%d)", strerror(errno), errno);
+      }
+
       break;
     }
     if (errno == EAGAIN) {

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.