[DIFF] Fix net.py curses resize xterm

"Rob Cakebread" <[email protected]> Sun, 28 May 2006 15:37:53 -0700
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
------=_Part_80_4006575.1148855873184
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

When using the curses ui with the CVS version as of 4/28/2006 with
Python 2.4.3, lyntin disconnects if I resize an xterm:

! socket exception
! Traceback (most recent call last):
!   File "/usr/lib/python2.4/site-packages/lyntin/net.py", line 369, in run
!     newdata =3D self._pollForData()
!   File "/usr/lib/python2.4/site-packages/lyntin/net.py", line 328,
in _pollForData
!     readers, e, w =3D select.select([self._sock], [], [], .2)
! error: (4, 'Interrupted system call')
!
# Session genesis disconnected.

I've attached a patch that fixes the problem. I'm not sure if its the
cleanest way but it seems to work fine.

--- net.py.orig 2004-07-25 08:53:35.000000000 -0700
+++ net.py      2006-05-28 15:31:04.000000000 -0700
@@ -107,7 +107,7 @@
    data - the telnet option itself

 """
-import socket, select, re, os
+import socket, select, re, os, errno

 from lyntin import event, config, exported
 from lyntin.ui import message
@@ -325,7 +325,13 @@
     """
     Polls the socket for data.
     """
+    #try:
     readers, e, w =3D select.select([self._sock], [], [], .2)
+    #except select.error, (nr, msg):
+    #  if nr =3D=3D errno.EINTR:
+    #    readers =3D None
+    #  else:
+    #    raise
     if readers:
       return readers[0].recv(1024)

------=_Part_80_4006575.1148855873184
Content-Type: application/octet-stream; name=net.py.patch
Content-Transfer-Encoding: 7bit
X-Attachment-Id: f_enrz487z
Content-Disposition: attachment; filename="net.py.patch"

--- net.py.orig	2004-07-25 08:53:35.000000000 -0700
+++ net.py	2006-05-28 15:31:04.000000000 -0700
@@ -107,7 +107,7 @@
    data - the telnet option itself
 
 """
-import socket, select, re, os
+import socket, select, re, os, errno
 
 from lyntin import event, config, exported
 from lyntin.ui import message
@@ -325,7 +325,13 @@
     """
     Polls the socket for data.
     """
+    #try:
     readers, e, w = select.select([self._sock], [], [], .2)
+    #except select.error, (nr, msg):
+    #  if nr == errno.EINTR:
+    #    readers = None
+    #  else:
+    #    raise
     if readers:
       return readers[0].recv(1024)
 

------=_Part_80_4006575.1148855873184--


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642