unix: Report connected status to socket module

Report connected status to the socket module. Otherwise, operations
like `getpeername` would not work correctly.

Fixes #18534.

Change-Id: I99d047f0d7b4d442cc2b3ea9222b0d89d216c1ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6719
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Trung Nguyen
2023-08-03 06:47:44 +00:00
committed by Adrien Destugues
parent 3a6bc1cf65
commit abf8d2e209
2 changed files with 4 additions and 1 deletions
@@ -185,6 +185,7 @@ UnixDatagramEndpoint::Connect(const struct sockaddr* _address)
// Required by the socket layer.
PeerAddress().SetTo(&fTargetEndpoint->socket->address);
gSocketModule->set_connected(Socket());
RETURN_ERROR(B_OK);
}
@@ -323,7 +323,7 @@ UnixStreamEndpoint::Connect(const struct sockaddr* _address)
fState = unix_stream_endpoint_state::Connected;
fWasConnected = true;
gSocketModule->set_connected(newSocket);
gSocketModule->set_connected(Socket());
release_sem(listeningEndpoint->fAcceptSemaphore);
@@ -709,6 +709,8 @@ UnixStreamEndpoint::_Spawn(UnixStreamEndpoint* connectingEndpoint,
fCredentials = listeningEndpoint->fCredentials;
fState = unix_stream_endpoint_state::Connected;
gSocketModule->set_connected(Socket());
}