|
|
@@ -944,15 +944,17 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
|
|
}
|
|
|
var dummy byte
|
|
|
if len(oob) > 0 {
|
|
|
- var sockType int
|
|
|
- sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- // receive at least one normal byte
|
|
|
- if sockType != SOCK_DGRAM && len(p) == 0 {
|
|
|
- iov.Base = &dummy
|
|
|
- iov.SetLen(1)
|
|
|
+ if len(p) == 0 {
|
|
|
+ var sockType int
|
|
|
+ sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // receive at least one normal byte
|
|
|
+ if sockType != SOCK_DGRAM {
|
|
|
+ iov.Base = &dummy
|
|
|
+ iov.SetLen(1)
|
|
|
+ }
|
|
|
}
|
|
|
msg.Control = &oob[0]
|
|
|
msg.SetControllen(len(oob))
|
|
|
@@ -996,15 +998,17 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
|
|
}
|
|
|
var dummy byte
|
|
|
if len(oob) > 0 {
|
|
|
- var sockType int
|
|
|
- sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
|
|
- if err != nil {
|
|
|
- return 0, err
|
|
|
- }
|
|
|
- // send at least one normal byte
|
|
|
- if sockType != SOCK_DGRAM && len(p) == 0 {
|
|
|
- iov.Base = &dummy
|
|
|
- iov.SetLen(1)
|
|
|
+ if len(p) == 0 {
|
|
|
+ var sockType int
|
|
|
+ sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
|
|
+ if err != nil {
|
|
|
+ return 0, err
|
|
|
+ }
|
|
|
+ // send at least one normal byte
|
|
|
+ if sockType != SOCK_DGRAM {
|
|
|
+ iov.Base = &dummy
|
|
|
+ iov.SetLen(1)
|
|
|
+ }
|
|
|
}
|
|
|
msg.Control = &oob[0]
|
|
|
msg.SetControllen(len(oob))
|