1
0
mirror of https://github.com/janet-lang/janet synced 2025-08-28 00:22:26 +00:00

Fix: Correctly flag UDP streams in net/connect #1620

This commit is contained in:
Seungki Kim 2025-08-11 20:56:04 +09:00
parent 0aee7765cf
commit 3ad86108f2

View File

@ -547,7 +547,9 @@ JANET_CORE_FN(cfun_net_connect,
}
/* Wrap socket in abstract type JanetStream */
JanetStream *stream = make_stream(sock, JANET_STREAM_READABLE | JANET_STREAM_WRITABLE);
uint32_t udp_flag = 0;
if (socktype == SOCK_DGRAM) udp_flag = JANET_STREAM_UDPSERVER;
JanetStream *stream = make_stream(sock, JANET_STREAM_READABLE | JANET_STREAM_WRITABLE | udp_flag);
/* Set up the socket for non-blocking IO before connecting */
janet_net_socknoblock(sock);