[PATCH] Remove socket if it already exists
Daniel Drake
dsd at laptop.org
Fri Nov 20 09:03:43 EST 2009
bind() fails on a unix domain socket when it already exists, even if it
is unused. And recent versions of Sugar don't clean out the instance
directory (possibly just due to lack of Rainbow).
---
activity.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/activity.py b/activity.py
index 145224d..26e411e 100644
--- a/activity.py
+++ b/activity.py
@@ -255,6 +255,8 @@ class AcousticMeasureActivity(Activity):
# The filename cannot be in $TMP, because this directory is not
# visible to Telepathy.
f = sugar.activity.activity.get_activity_root() + '/instance/my_socket'
+ if os.path.exists(f):
+ os.unlink(f)
self.server_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.server_socket.bind(f)
--
1.6.2.5
--=-b6dX+YqIVTNPNML/yzj9--
More information about the Sugar-devel
mailing list