msmith - in flumotion/trunk: . flumotion/twisted
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Tue Feb 27 18:38:00 CET 2007
Author: msmith
Date: Tue Feb 27 18:37:56 2007
New Revision: 4533
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/flumotion/twisted/fdserver.py
Log:
* flumotion/twisted/fdserver.py:
Comments to make wingo weep a little less.
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Tue Feb 27 18:37:56 2007
@@ -1,5 +1,10 @@
2007-02-27 Michael Smith <msmith at fluendo.com>
+ * flumotion/twisted/fdserver.py:
+ Comments to make wingo weep a little less.
+
+2007-02-27 Michael Smith <msmith at fluendo.com>
+
* flumotion/component/feedcomponent.py:
* flumotion/component/feedcomponent010.py:
Split removeFDCallback into removeClientCallback and
Modified: flumotion/trunk/flumotion/twisted/fdserver.py
==============================================================================
--- flumotion/trunk/flumotion/twisted/fdserver.py (original)
+++ flumotion/trunk/flumotion/twisted/fdserver.py Tue Feb 27 18:37:56 2007
@@ -35,7 +35,11 @@
# and client.py
# Thanks for the inspiration!
-# 16 byte long randomly-generated magic signature
+# Since we're doing this over a stream socket, our file descriptor messages
+# aren't guaranteed to be received alone; they could arrive along with some
+# unrelated data.
+# So, we prefix the message with a 16 byte magic signature, and a length,
+# and if we receive file descriptors decode based on this.
MAGIC_SIGNATURE = "\xfd\xfc\x8e\x7f\x07\x47\xb9\xea" \
"\xa1\x75\xee\xd8\xdc\x36\xc8\xa3"
@@ -63,6 +67,12 @@
return main.CONNECTION_DONE
if len(fds) > 0:
+ # Look for our magic cookie in (possibly) the midst of other
+ # data. Pass surrounding chunks, if any, onto dataReceived(),
+ # which (undocumentedly) must return None unless a failure
+ # occurred.
+ # Pass the actual FDs and their message to
+ # fileDescriptorsReceived()
offset = message.find(MAGIC_SIGNATURE)
if offset < 0:
raise TypeError("Bad signature")
More information about the flumotion-commit
mailing list