summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--socket.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/socket.c b/socket.c
index 07286974..39c4d931 100644
--- a/socket.c
+++ b/socket.c
@@ -602,7 +602,6 @@ static val dgram_set_sock_peer(val stream, val peer)
{
struct dgram_stream *d = coerce(struct dgram_stream *, stream->co.handle);
sockaddr_pack(peer, d->family, &d->peer_addr, &d->pa_len);
- d->sock_connected = 1;
return set(mkloc(d->peer, stream), peer);
}
@@ -736,6 +735,11 @@ static val sock_connect(val sock, val sockaddr, val timeout)
sock_set_peer(sock, sockaddr);
+ if (sock_type(sock) == num_fast(SOCK_DGRAM)) {
+ struct dgram_stream *d = coerce(struct dgram_stream *, sock->co.handle);
+ d->sock_connected = 1;
+ }
+
return sock;
}