diff seobeo/s_network.c @ 128:7eb79fd91c7e

[Misc] Fixed all bazel targets. I should creat a separate scripts for these lol.
author June Park <parkjune1995@gmail.com>
date Thu, 08 Jan 2026 19:20:56 -0800
parents c39582f937e5
children 1c4d8873e846
line wrap: on
line diff
--- a/seobeo/s_network.c	Thu Jan 08 18:05:47 2026 -0800
+++ b/seobeo/s_network.c	Thu Jan 08 19:20:56 2026 -0800
@@ -103,6 +103,11 @@
   { perror("connect"); return NULL; }
   freeaddrinfo(server_infos);
 
+  // Set non-blocking
+  int flags = fcntl(socket_fd, F_GETFL, 0);
+  if (flags == -1 || fcntl(socket_fd, F_SETFL, flags | O_NONBLOCK) != 0)
+  { perror("fcntl"); close(socket_fd); free(p_handle); return NULL; }
+
   p_handle->socket = socket_fd;
   p_handle->type = SEOBEO_STREAM_TYPE_CLIENT;