Module: sems
Branch: master
Commit: a170f8f0d66d8149b29c271774ebb2fafb0a742d
URL: 
https://github.com/sems-server/sems/commit/a170f8f0d66d8149b29c271774ebb2fafb0a742d

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date: 2015-03-30T14:13:48+02:00

b/f: raw_sock: return combined bytes send on fragmentation

patch by Michael Furmur

---

Modified: core/sip/raw_sock.cpp

---

Diff:  
https://github.com/sems-server/sems/commit/a170f8f0d66d8149b29c271774ebb2fafb0a742d.diff
Patch: 
https://github.com/sems-server/sems/commit/a170f8f0d66d8149b29c271774ebb2fafb0a742d.patch

---

diff --git a/core/sip/raw_sock.cpp b/core/sip/raw_sock.cpp
index 20ca02e..c1b9b72 100644
--- a/core/sip/raw_sock.cpp
+++ b/core/sip/raw_sock.cpp
@@ -608,6 +608,7 @@ int raw_iphdr_udp4_send(int rsock, const char* buf, 
unsigned int len,
          ret=sendmsg(rsock, &snd_msg, 0);
 #ifndef RAW_IPHDR_INC_AUTO_FRAG
        } else {
+         int bytes_sent;
          ip_payload = len + sizeof(hdr.udp);
          /* a fragment offset must be a multiple of 8 => its size must
             also be a multiple of 8, except for the last fragment */
@@ -635,6 +636,7 @@ int raw_iphdr_udp4_send(int rsock, const char* buf, 
unsigned int len,
          ret=sendmsg(rsock, &snd_msg, 0);
          if (unlikely(ret < 0))
            goto end;
+         bytes_sent = ret;
          /* all the other fragments, include only the ip header */
          iov[0].iov_len = sizeof(hdr.ip);
          iov[1].iov_base =  (char*)iov[1].iov_base + iov[1].iov_len;
@@ -651,6 +653,7 @@ int raw_iphdr_udp4_send(int rsock, const char* buf, 
unsigned int len,
            ret=sendmsg(rsock, &snd_msg, 0);
            if (unlikely(ret < 0))
              goto end;
+           bytes_sent+=ret;
            iov[1].iov_base =  (char*)iov[1].iov_base + iov[1].iov_len;
          }
          /* last fragment */
@@ -664,6 +667,7 @@ int raw_iphdr_udp4_send(int rsock, const char* buf, 
unsigned int len,
          ret=sendmsg(rsock, &snd_msg, 0);
          if (unlikely(ret < 0))
            goto end;
+         ret+=bytes_sent;
        }
 end:
 #endif /* RAW_IPHDR_INC_AUTO_FRAG */

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to