Ticket #9424: patch-patch-tsocks.c

File patch-patch-tsocks.c, 1.1 KB (added by darren.bane@…, 18 years ago)

Patch against net/tsocks/files/patch-tsocks.c

Line 
1--- patch-tsocks.c.orig 2006-06-13 19:37:59.000000000 +0100
2+++ patch-tsocks.c      2006-06-13 19:24:49.000000000 +0100
3@@ -21,4 +21,25 @@
4        unsigned int res = -1;
5        struct serverent *path;
6     struct connreq *newconn;
7+@@ -660,7 +660,7 @@
8+              * come around again (since we can't flag it for read, we don't know
9+              * if there is any data to be read and can't be bothered checking) */
10+             if (conn->selectevents & WRITE) {
11+-               setevents |= POLLOUT; 
12++               ufds[i].revents |= (conn->selectevents & WRITE);
13+                nevents++;
14+             }
15+          }
16+@@ -854,7 +854,11 @@
17+                     sizeof(conn->serveraddr));
18 
19+    show_msg(MSGDEBUG, "Connect returned %d, errno is %d\n", rc, errno); 
20+-      if (rc) {
21++      if (rc && errno == EISCONN) {
22++      rc = 0;
23++      show_msg(MSGDEBUG, "Socket %d already connected to SOCKS server\n", conn->sockid);
24++      conn->state = CONNECTED;
25++   } else if (rc) {
26+       if (errno != EINPROGRESS) {
27+          show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
28+                   "server (%s)\n", errno, strerror(errno));