Skip to content

Commit

Permalink
net: sockets: tls: Return an error on send() after session is closed
Browse files Browse the repository at this point in the history
It was an overlook to return 0 on TLS send() call, after detecting that
TLS session has been closed by peer, such a behavior is only valid for
recv(). Instead, an error should be returned.

Signed-off-by: Robert Lubos <[email protected]>
  • Loading branch information
rlubos authored and fabiobaltieri committed Feb 28, 2024
1 parent a6b0600 commit dc52b20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion subsys/net/lib/sockets/sockets_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,8 @@ static ssize_t send_tls(struct tls_context *ctx, const void *buf,
}

if (ctx->session_closed) {
return 0;
errno = ECONNABORTED;
return -1;
}

if (!is_block) {
Expand Down

0 comments on commit dc52b20

Please sign in to comment.