Page MenuHomeFreeBSD

The socket SO_LINGER option don't work.
AcceptedPublic

Authored by shichun_ma_dell.com on Feb 22 2021, 6:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 1:58 AM
Unknown Object (File)
Mar 7 2024, 12:55 AM
Unknown Object (File)
Mar 7 2024, 12:00 AM
Unknown Object (File)
Dec 31 2023, 12:22 PM
Unknown Object (File)
Dec 23 2023, 4:09 AM
Unknown Object (File)
Dec 19 2023, 5:53 PM
Unknown Object (File)
Nov 20 2023, 6:43 AM
Unknown Object (File)
Aug 16 2023, 8:17 AM

Details

Reviewers
rscheff
Group Reviewers
transport
network
Summary

Function sodisconnect is run before SO_LINGER option process, so the socket will be closed immediately after data is sent, which will cause another process cannot communicate with current process before the data is received. Because the two process run asynchronous, and client maybe close before server data is received.

Test Plan

use unix socket to communicate between two program.One program run as server, and another as client.
the sent data size of client is very small, and immediately close after calling send .
in the server process, call getpeername function after accept finished.
expect getpeername doesn't return error and error infomation is: "errorno 107 Socket is not connected".

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

shichun_ma_dell.com created this revision.
rscheff added a subscriber: rscheff.

The diff doesn't appear to be case on HEAD.

Other than this, reads like SO_LINGER could never properly work without this since a memory leak was fixed in 2006...

This revision is now accepted and ready to land.Mar 9 2021, 5:10 PM

Could you describe what the observed behaviour without this patch is and what the intended behaviour is for a TCP socket?

May you please provide context to the diff?