Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145475812
D15765.id43619.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15765.id43619.diff
View Options
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -2182,6 +2182,8 @@
flags = 0;
if (controlp != NULL)
*controlp = NULL;
+ if (flags & (MSG_PEEK|MSG_WAITALL))
+ return (soreceive_generic(so, psa, uio, mp0, controlp, flagsp));
if (flags & MSG_OOB)
return (soreceive_rcvoob(so, uio, flags));
if (mp0 != NULL)
@@ -2218,8 +2220,7 @@
if (oresid > uio->uio_resid)
goto out;
error = so->so_error;
- if (!(flags & MSG_PEEK))
- so->so_error = 0;
+ so->so_error = 0;
goto out;
}
@@ -2239,8 +2240,7 @@
}
/* Socket buffer got some data that we shall deliver now. */
- if (sbavail(sb) > 0 && !(flags & MSG_WAITALL) &&
- ((so->so_state & SS_NBIO) ||
+ if (sbavail(sb) > 0 && ((so->so_state & SS_NBIO) ||
(flags & (MSG_DONTWAIT|MSG_NBIO)) ||
sbavail(sb) >= sb->sb_lowat ||
sbavail(sb) >= uio->uio_resid ||
@@ -2275,7 +2275,7 @@
len = min(uio->uio_resid, sbavail(sb));
if (mp0 != NULL) {
/* Dequeue as many mbufs as possible. */
- if (!(flags & MSG_PEEK) && len >= sb->sb_mb->m_len) {
+ if (len >= sb->sb_mb->m_len) {
if (*mp0 == NULL)
*mp0 = sb->sb_mb;
else
@@ -2330,27 +2330,19 @@
* Remove the delivered data from the socket buffer unless we
* were only peeking.
*/
- if (!(flags & MSG_PEEK)) {
- if (len > 0)
- sbdrop_locked(sb, len);
-
- /* Notify protocol that we drained some data. */
- if ((so->so_proto->pr_flags & PR_WANTRCVD) &&
- (((flags & MSG_WAITALL) && uio->uio_resid > 0) ||
- !(flags & MSG_SOCALLBCK))) {
- SOCKBUF_UNLOCK(sb);
- VNET_SO_ASSERT(so);
- (*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags);
- SOCKBUF_LOCK(sb);
- }
+ if (len > 0)
+ sbdrop_locked(sb, len);
+
+ /* Notify protocol that we drained some data. */
+ if ((so->so_proto->pr_flags & PR_WANTRCVD) &&
+ (((flags & MSG_WAITALL) && uio->uio_resid > 0) ||
+ !(flags & MSG_SOCALLBCK))) {
+ SOCKBUF_UNLOCK(sb);
+ VNET_SO_ASSERT(so);
+ (*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags);
+ SOCKBUF_LOCK(sb);
}
- /*
- * For MSG_WAITALL we may have to loop again and wait for
- * more data to come in.
- */
- if ((flags & MSG_WAITALL) && uio->uio_resid > 0)
- goto restart;
out:
SOCKBUF_LOCK_ASSERT(sb);
SBLASTRECORDCHK(sb);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 21, 8:25 AM (3 h, 59 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28916141
Default Alt Text
D15765.id43619.diff (2 KB)
Attached To
Mode
D15765: fallback to soreceive_generic in soreceive_stream for cases not handled correctly currently
Attached
Detach File
Event Timeline
Log In to Comment