summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_sockbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/uipc_sockbuf.c')
-rw-r--r--sys/kern/uipc_sockbuf.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index e979251..16fa1f8 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -1027,9 +1027,24 @@ sbappendcontrol(sb, m0, control)
}
/*
- * Compress mbuf chain m into the socket
- * buffer sb following mbuf n. If n
- * is null, the buffer is presumed empty.
+ * Append the data in mbuf chain (m) into the socket buffer sb following mbuf
+ * (n). If (n) is NULL, the buffer is presumed empty.
+ *
+ * When the data is compressed, mbufs in the chain may be handled in one of
+ * three ways:
+ *
+ * (1) The mbuf may simply be dropped, if it contributes nothing (no data, no
+ * record boundary, and no change in data type).
+ *
+ * (2) The mbuf may be coalesced -- i.e., data in the mbuf may be copied into
+ * an mbuf already in the socket buffer. This can occur if an
+ * appropriate mbuf exists, there is room, and no merging of data types
+ * will occur.
+ *
+ * (3) The mbuf may be appended to the end of the existing mbuf chain.
+ *
+ * If any of the new mbufs is marked as M_EOR, mark the last mbuf appended as
+ * end-of-record.
*/
void
sbcompress(sb, m, n)
@@ -1080,10 +1095,8 @@ sbcompress(sb, m, n)
n->m_next = 0;
}
if (eor) {
- if (n)
- n->m_flags |= eor;
- else
- printf("semi-panic: sbcompress\n");
+ KASSERT(n != NULL, ("sbcompress: eor && n == NULL"));
+ n->m_flags |= eor;
}
SBLASTMBUFCHK(sb);
}
OpenPOWER on IntegriCloud