mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
cleanup-proxy-code--add-timeout.patch
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
02244bb889
commit
5b9a4c0d43
1 changed files with 15 additions and 6 deletions
|
@ -191,22 +191,31 @@ libwebsocket_client_connect(struct libwebsocket_context *this,
|
|||
|
||||
/* we are connected to server, or proxy */
|
||||
|
||||
/* non-SSL connection */
|
||||
|
||||
if (this->http_proxy_port) {
|
||||
|
||||
n = send(wsi->sock, pkt, plen, 0);
|
||||
if (n < 0) {
|
||||
fprintf(stderr, "ERROR writing to "
|
||||
"proxy socket\n");
|
||||
close(wsi->sock);
|
||||
fprintf(stderr, "ERROR writing to proxy socket\n");
|
||||
goto bail1;
|
||||
}
|
||||
|
||||
pfd.fd = wsi->sock;
|
||||
pfd.events = POLLIN;
|
||||
pfd.revents = 0;
|
||||
|
||||
n = poll(&pfd, 1, 5000);
|
||||
if (n <= 0) {
|
||||
close(wsi->sock);
|
||||
fprintf(stderr, "libwebsocket_client_handshake "
|
||||
"timeout on proxy response");
|
||||
goto bail1;
|
||||
}
|
||||
|
||||
n = recv(wsi->sock, pkt, sizeof pkt, 0);
|
||||
if (n < 0) {
|
||||
close(wsi->sock);
|
||||
fprintf(stderr, "ERROR reading from "
|
||||
"proxy socket\n");
|
||||
fprintf(stderr, "ERROR reading from proxy socket\n");
|
||||
goto bail1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue