Skip to content

Commit 85e05b0

Browse files
committed
Merge pull request #2376 from pguyot/w29/fix-freebsd-flake-networking
generic_unix: use a graceful close for TCP server sockets These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 9e1c16b + 7e9208c commit 85e05b0

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7777
- Fixed several underallocation issues that could trigger data corruption on `binary:replace`, `zlib:compress` and bsd socket recv code.
7878
- Fixed a bug where `catch` would raise on regular atom results
7979
- Fixed ESP32 socket driver holding the global socket-list lock across blocking TCP connects, leaking the port on connect failure, losing concurrent `accept` waiters, leaking `netbuf` on receive error paths, and a recycled-`netconn` race between socket close and the event handler
80+
- Fixed generic_unix TCP server sockets performing an abortive close that could truncate replies awaiting ack
8081

8182
## [0.7.0-alpha.1] - 2026-04-06
8283

src/platforms/generic_unix/lib/socket_driver.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,8 @@ static term init_server_tcp_socket(Context *ctx, SocketDriverData *socket_data,
367367
}
368368
socket_data->sockfd = sockfd;
369369

370-
//
371-
// set socket options:
372-
// reuse-address
373-
// disable linger
374-
//
375370
int flag = 1;
376371
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(int));
377-
struct linger sl;
378-
sl.l_onoff = 1;
379-
sl.l_linger = 0;
380-
setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &sl, sizeof(sl));
381372

382373
if (fcntl(socket_data->sockfd, F_SETFL, O_NONBLOCK) == -1) {
383374
close(sockfd);

0 commit comments

Comments
 (0)