1
0
mirror of https://github.com/janet-lang/janet synced 2025-08-25 15:12:25 +00:00

Merge pull request #1621 from tttuuu888/work-issue-1620

Fix: Correctly flag UDP streams in net/connect #1620
This commit is contained in:
Calvin Rose 2025-08-12 16:04:52 -05:00 committed by GitHub
commit 1ead670e33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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);