Package: tsocks
Version: 1.8beta5-9.1
Severity: normal
Tags: patch

Scenario: create a socket, set it non-blocking, run a connect call,
and then "select" on it. If the socks connection fails (I'm using SSH
for the SOCKS) then the select starts taking 100% CPU without really
blocking. (i.e., if another fd event happens, it will return. But then
again, there is no way to find out that the earlier socket is now in a
bad state, and when you call select on it again, it takes 100% as
before.)

I've attached a patch, which might not be entirely perfect but might
explain the issue and the solution.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages tsocks depends on:
ii  libc6                         2.9-12     GNU C Library: Shared libraries

tsocks recommends no packages.

tsocks suggests no packages.

-- no debconf information
Only in tsocks-1.8beta5-deb/: #tsocks.c#
Common subdirectories: tsocks-1.8beta5-deb/debian and tsocks-1.8beta5/debian
Binary files tsocks-1.8beta5-deb/libtsocks.so and tsocks-1.8beta5/libtsocks.so differ
Binary files tsocks-1.8beta5-deb/libtsocks.so.1.8 and tsocks-1.8beta5/libtsocks.so.1.8 differ
diff -u tsocks-1.8beta5-deb/tsocks.c tsocks-1.8beta5/tsocks.c
--- tsocks-1.8beta5-deb/tsocks.c	2009-08-25 19:07:18.000000000 -0400
+++ tsocks-1.8beta5/tsocks.c	2009-08-25 19:44:31.000000000 -0400
@@ -1053,6 +1053,7 @@
          show_msg(MSGDEBUG, "Peer has shutdown but we only read %d of %d bytes.\n",
             conn->datadone, conn->datalen);
          rc = ENOTCONN; /* ENOTCONN seems like the most fitting error message */
+	 conn->state = FAILED;
       } else {
          if (errno != EWOULDBLOCK)
             show_msg(MSGDEBUG, "Read failed, %s\n", strerror(errno));
Only in tsocks-1.8beta5: tsocks.c~
Binary files tsocks-1.8beta5-deb/tsocks.o and tsocks-1.8beta5/tsocks.o differ

Reply via email to