Implement WebSocket reverse proxy

This commit is contained in:
2022-08-18 03:07:54 +02:00
parent 041e4d43a7
commit c92742275a
11 changed files with 319 additions and 33 deletions

@ -130,11 +130,12 @@ int sock_poll(sock *sockets[], sock *ready[], short events, int n_sock, int time
int ret = poll(fds, n_sock, timeout_ms);
if (ret < 0 || ready == NULL) return ret;
for (int i = 0, j = 0; i < ret; j++) {
int j = 0;
for (int i = 0; i < n_sock; i++) {
if (fds[i].revents & events)
ready[i++] = sockets[j];
ready[j++] = sockets[i];
}
return ret;
return j;
}
int sock_poll_read(sock *sockets[], sock *readable[], int n_sock, int timeout_ms) {