[Slirp] [Git][slirp/libslirp][master] sosendoob: better document what urgc is used for

Samuel Thibault gitlab at gitlab.freedesktop.org
Wed Aug 19 21:28:44 UTC 2020



Samuel Thibault pushed to branch master at slirp / libslirp


Commits:
1b0093b9 by Samuel Thibault at 2020-08-19T23:27:56+02:00
sosendoob: better document what urgc is used for

- - - - -


1 changed file:

- src/socket.c


Changes:

=====================================
src/socket.c
=====================================
@@ -336,8 +336,8 @@ int sosendoob(struct socket *so)
     DEBUG_ARG("so = %p", so);
     DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc);
 
-    if (so->so_urgc > 2048)
-        so->so_urgc = 2048; /* XXXX */
+    if (so->so_urgc > sizeof(buff))
+        so->so_urgc = sizeof(buff); /* XXXX */
 
     if (sb->sb_rptr < sb->sb_wptr) {
         /* We can send it directly */
@@ -349,7 +349,7 @@ int sosendoob(struct socket *so)
          * we must copy all data to a linear buffer then
          * send it all
          */
-        uint32_t urgc = so->so_urgc;
+        uint32_t urgc = so->so_urgc; /* Amount of room left in buff */
         int len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;
         if (len > urgc) {
             len = urgc;
@@ -357,6 +357,7 @@ int sosendoob(struct socket *so)
         memcpy(buff, sb->sb_rptr, len);
         urgc -= len;
         if (urgc) {
+            /* We still have some room for the rest */
             n = sb->sb_wptr - sb->sb_data;
             if (n > urgc) {
                 n = urgc;



View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/1b0093b973cfa0dc041522e5d4e6f576b2df642e

-- 
View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/1b0093b973cfa0dc041522e5d4e6f576b2df642e
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/slirp/attachments/20200819/5df36faa/attachment-0001.htm>


More information about the Slirp mailing list