Revert "net_socket: getpeername now only works on connected socket"

This reverts commit 04fac889f7.

Reason for revert: Breaks Qt, the behavior is incorrect it seems.

Change-Id: I09d35c214c899d0c06d7780b13db795fb2a3393a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2538
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
waddlesplash 2020-04-29 13:50:03 +00:00
parent af6ecfa5a2
commit 4835a173bd

View File

@ -1054,11 +1054,10 @@ socket_connect(net_socket* socket, const struct sockaddr* address,
int
socket_getpeername(net_socket* _socket, struct sockaddr* address,
socket_getpeername(net_socket* socket, struct sockaddr* address,
socklen_t* _addressLength)
{
net_socket_private* socket = (net_socket_private*)_socket;
if (!socket->is_connected || socket->peer.ss_len == 0)
if (socket->peer.ss_len == 0)
return ENOTCONN;
memcpy(address, &socket->peer, min_c(*_addressLength, socket->peer.ss_len));