Skip to content

Commit 5d21cb7

Browse files
Erik Hugnedavem330
authored andcommitted
tipc: allow implicit connect for stream sockets
TIPC's implied connect feature, aka piggyback connect, allows applications to save one syscall and all SYN/SYN-ACK signalling overhead when setting up a connection. Until now, this has only been supported for SEQPACKET sockets. Here, we make it possible to use this feature even with stream sockets. At the connecting side, the connection is completed when the first data message arrives from the accepting peer. This means that we must allow the connecting user to call blocking recv() before the socket has reached state SS_CONNECTED. So we must must relax the state machine check at recv_stream(), and allow the recv() call even if socket is in state SS_CONNECTING. Signed-off-by: Erik Hugne <[email protected]> Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cc79dd1 commit 5d21cb7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/tipc/socket.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
518518
res = -EISCONN;
519519
goto exit;
520520
}
521-
if ((tport->published) ||
522-
((sock->type == SOCK_STREAM) && (total_len != 0))) {
521+
if (tport->published) {
523522
res = -EOPNOTSUPP;
524523
goto exit;
525524
}
@@ -1010,8 +1009,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
10101009

10111010
lock_sock(sk);
10121011

1013-
if (unlikely((sock->state == SS_UNCONNECTED) ||
1014-
(sock->state == SS_CONNECTING))) {
1012+
if (unlikely((sock->state == SS_UNCONNECTED))) {
10151013
res = -ENOTCONN;
10161014
goto exit;
10171015
}

0 commit comments

Comments
 (0)