Mercurial
comparison seobeo/s_linux_network.c @ 71:75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Sun, 28 Dec 2025 20:34:22 -0800 |
| parents | 6626ec933933 |
| children | 70401cf61e97 |
comparison
equal
deleted
inserted
replaced
| 70:4bc56e88e1f3 | 71:75de5903355c |
|---|---|
| 43 break; | 43 break; |
| 44 } | 44 } |
| 45 | 45 |
| 46 if (listen(socket_fd, 16) != 0) | 46 if (listen(socket_fd, 16) != 0) |
| 47 { | 47 { |
| 48 printf("Closing: %d", socket_fd); | 48 printf("Closing: %d\n", socket_fd); |
| 49 perror("listen"); close(socket_fd); return NULL; | 49 perror("listen"); close(socket_fd); return NULL; |
| 50 } | 50 } |
| 51 | 51 |
| 52 int flags = fcntl(socket_fd, F_GETFL, 0); | 52 int flags = fcntl(socket_fd, F_GETFL, 0); |
| 53 if(fcntl(socket_fd, F_SETFL, flags | O_NONBLOCK) != 0) { perror("fcntl"); return NULL; } | 53 if(fcntl(socket_fd, F_SETFL, flags | O_NONBLOCK) != 0) { perror("fcntl"); return NULL; } |
| 200 if (p_handle->port) Dowa_Free(p_handle->port); | 200 if (p_handle->port) Dowa_Free(p_handle->port); |
| 201 | 201 |
| 202 Seobeo_SSL_Cleanup(p_handle); | 202 Seobeo_SSL_Cleanup(p_handle); |
| 203 | 203 |
| 204 if (p_handle->socket) { | 204 if (p_handle->socket) { |
| 205 printf("Closing: %d", p_handle->socket); | 205 printf("Closing: %d\n", p_handle->socket); |
| 206 close(p_handle->socket); | 206 close(p_handle->socket); |
| 207 } | 207 } |
| 208 | 208 |
| 209 if (p_handle->read_buffer) Dowa_Free(p_handle->read_buffer); | 209 if (p_handle->read_buffer) Dowa_Free(p_handle->read_buffer); |
| 210 if (p_handle->write_buffer) Dowa_Free(p_handle->write_buffer); | 210 if (p_handle->write_buffer) Dowa_Free(p_handle->write_buffer); |
| 332 if (p_handle->ssl) | 332 if (p_handle->ssl) |
| 333 { | 333 { |
| 334 read_size = Seobeo_SSL_Read(p_handle, p_handle->read_buffer + p_handle->read_buffer_len, free_space); | 334 read_size = Seobeo_SSL_Read(p_handle, p_handle->read_buffer + p_handle->read_buffer_len, free_space); |
| 335 if (read_size < 0) return read_size; // -1 for error, -2 for closed | 335 if (read_size < 0) return read_size; // -1 for error, -2 for closed |
| 336 if (read_size == 0) return 0; // would block | 336 if (read_size == 0) return 0; // would block |
| 337 }else | 337 } |
| 338 else | |
| 338 { | 339 { |
| 339 read_size = (int32)read(p_handle->socket, | 340 read_size = (int32)read(p_handle->socket, |
| 340 p_handle->read_buffer + p_handle->read_buffer_len, | 341 p_handle->read_buffer + p_handle->read_buffer_len, |
| 341 free_space); | 342 free_space); |
| 342 if (read_size == 0) return -2; | 343 if (read_size == 0) return -2; |