Mercurial
comparison seobeo/os/s_linux_edge.c @ 66:a0f0ad5e42eb
[Misc] taking out capital P stuff.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 24 Dec 2025 06:34:19 -0800 |
| parents | ecb6ee6a22c3 |
| children | 75de5903355c |
comparison
equal
deleted
inserted
replaced
| 65:ecb6ee6a22c3 | 66:a0f0ad5e42eb |
|---|---|
| 33 perror("epoll_wait"); | 33 perror("epoll_wait"); |
| 34 continue; | 34 continue; |
| 35 } | 35 } |
| 36 | 36 |
| 37 for (int i = 0; i < n; i++) { | 37 for (int i = 0; i < n; i++) { |
| 38 Seobeo_PHandle phandle = events[i].data.ptr; | 38 Seobeo_Handle *phandle = events[i].data.ptr; |
| 39 | 39 |
| 40 if (phandle == args->srv) { | 40 if (phandle == args->srv) { |
| 41 // Accept all pending connections (edge-triggered mode) | 41 // Accept all pending connections (edge-triggered mode) |
| 42 while (1) { | 42 while (1) { |
| 43 Seobeo_PHandle p_cli_handle = Seobeo_Stream_Handle_Server_Accept(args->srv); | 43 Seobeo_Handle *p_cli_handle = Seobeo_Stream_Handle_Server_Accept(args->srv); |
| 44 if (!p_cli_handle) break; | 44 if (!p_cli_handle) break; |
| 45 | 45 |
| 46 struct epoll_event client_ev = { | 46 struct epoll_event client_ev = { |
| 47 .events = EPOLLIN | EPOLLET, | 47 .events = EPOLLIN | EPOLLET, |
| 48 .data.ptr = p_cli_handle | 48 .data.ptr = p_cli_handle |
| 66 close(epfd); | 66 close(epfd); |
| 67 return NULL; | 67 return NULL; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void Seobeo_Web_Edge( | 70 void Seobeo_Web_Edge( |
| 71 Seobeo_PHandle p_server_handle, | 71 Seobeo_Handle *p_server_handle, |
| 72 int thread_count, | 72 int thread_count, |
| 73 Dowa_HashMap *p_html_cache) | 73 Dowa_HashMap *p_html_cache) |
| 74 { | 74 { |
| 75 pthread_attr_t attr; | 75 pthread_attr_t attr; |
| 76 pthread_attr_init(&attr); | 76 pthread_attr_init(&attr); |
| 91 | 91 |
| 92 pthread_attr_destroy(&attr); | 92 pthread_attr_destroy(&attr); |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 void Seobeo_Web_Edge_2(Seobeo_PHandle p_handle_server, Dowa_HashMap *cache) | 96 void Seobeo_Web_Edge_2(Seobeo_Handle *p_handle_server, Dowa_HashMap *cache) |
| 97 { | 97 { |
| 98 const int MAX_EVENTS = 1024; | 98 const int MAX_EVENTS = 1024; |
| 99 struct epoll_event events[MAX_EVENTS]; | 99 struct epoll_event events[MAX_EVENTS]; |
| 100 char keybuf[32]; | 100 char keybuf[32]; |
| 101 | 101 |
| 136 | 136 |
| 137 if (fd == p_handle_server->socket) | 137 if (fd == p_handle_server->socket) |
| 138 { | 138 { |
| 139 while (1) | 139 while (1) |
| 140 { | 140 { |
| 141 Seobeo_PHandle p_handle_client = Seobeo_Stream_Handle_Server_Accept(p_handle_server); | 141 Seobeo_Handle *p_handle_client = Seobeo_Stream_Handle_Server_Accept(p_handle_server); |
| 142 if (!p_handle_client) break; | 142 if (!p_handle_client) break; |
| 143 | 143 |
| 144 struct epoll_event client_ev = { | 144 struct epoll_event client_ev = { |
| 145 .events = EPOLLIN | EPOLLET, | 145 .events = EPOLLIN | EPOLLET, |
| 146 .data.fd = p_handle_client->socket | 146 .data.fd = p_handle_client->socket |
| 159 } | 159 } |
| 160 continue; | 160 continue; |
| 161 } | 161 } |
| 162 | 162 |
| 163 snprintf(keybuf, sizeof(keybuf), "%d", fd); | 163 snprintf(keybuf, sizeof(keybuf), "%d", fd); |
| 164 Seobeo_PHandle p_handle_client = Dowa_HashMap_Get(handles, keybuf); | 164 Seobeo_Handle *p_handle_client = Dowa_HashMap_Get(handles, keybuf); |
| 165 if (!p_handle_client) | 165 if (!p_handle_client) |
| 166 { | 166 { |
| 167 // might happen if client closed between event and lookup | 167 // might happen if client closed between event and lookup |
| 168 epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL); | 168 epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL); |
| 169 continue; | 169 continue; |