gnome-lirc-properties r29 - in trunk: . gnome_lirc_properties



Author: murrayc
Date: Wed May 14 22:26:51 2008
New Revision: 29
URL: http://svn.gnome.org/viewvc/gnome-lirc-properties?rev=29&view=rev

Log:
2008-05-15  Murray Cumming  <murrayc murrayc com>

* gnome_lirc_properties/lirc.py: KeyListener.__on_io_event():
Catch a SocketError when doing socket.recv(), to avoid a possible crash.
Ubuntu bug 
http://bugs.launchpad.net/ubuntu/+source/gnome-lirc-properties/+bug/224954
(not filed upstream).


Modified:
   trunk/ChangeLog
   trunk/gnome_lirc_properties/lirc.py

Modified: trunk/gnome_lirc_properties/lirc.py
==============================================================================
--- trunk/gnome_lirc_properties/lirc.py	(original)
+++ trunk/gnome_lirc_properties/lirc.py	Wed May 14 22:26:51 2008
@@ -363,7 +363,7 @@
 
         # Cope with Unknown vendors:
         # We store 'Unknown' (not translated) in the configuration file in backend.WriteRemoteConfiguration() if vendor is None:
-        vendor_name = vendor;
+        vendor_name = vendor
         if(vendor_name == 'Unknown'):
           vendor_name = None
 
@@ -867,7 +867,13 @@
 
         if condition & gobject.IO_IN:
             logging.info('reading from lirc socket %d...', fd)
-            packet = self.__socket and self.__socket.recv(128)
+
+            try:
+              # TODO: What is this 128? No magic numbers in code, please.
+              packet = self.__socket and self.__socket.recv(128)
+            except SocketError, ex:
+              logging.error('__on_io_event(): socket.recv() threw exception reading from lirc socket: %s', ex.message)
+              packet = ''
 
             logging.info('...%d bytes received.', len(packet))
             self.__buffer += packet
@@ -1064,7 +1070,7 @@
             return False
 
         if selected_remote is None:
-            return False;
+            return False
 
         if (remote.vendor == selected_remote.vendor and
             remote.product == selected_remote.product):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]