[tor-commits] [obfsproxy/master] Add a compatibility layer for Twisted's UnsupportedAddressFamily.

asn at torproject.org asn at torproject.org
Fri Apr 25 19:24:50 UTC 2014


commit befd673af04f1b7d1d7d4a3c92a824b61084b4fe
Author: George Kadianakis <desnacked at riseup.net>
Date:   Fri Apr 25 20:21:39 2014 +0100

    Add a compatibility layer for Twisted's UnsupportedAddressFamily.
    
    twisted.internet.error.UnsupportedAddressFamily was added in twisted-12.1.0.
    
    This commit adds a stub that emulates it for platforms that don't have a
    recent Twisted (e.g. Debian squeeze/wheezy).
---
 obfsproxy/network/socks5.py |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/obfsproxy/network/socks5.py b/obfsproxy/network/socks5.py
index f59ed73..88d0b3c 100644
--- a/obfsproxy/network/socks5.py
+++ b/obfsproxy/network/socks5.py
@@ -41,6 +41,15 @@ _SOCKS_RFC1929_VER = 0x01
 _SOCKS_RFC1929_SUCCESS = 0x00
 _SOCKS_RFC1929_FAIL = 0x01
 
+# This is a compatibility layer for twisted.internet.error.UnsupportedAddressFamily
+# which was added in twisted-12.1.0.
+# Defining this function should make older Twisted run properly (sorry for the kludge!)
+if not hasattr(error, "UnsupportedAddressFamily"):
+    class UnsupportedAddressFamily(Exception):
+        """ AKA EAFNOSUPPORT """
+        pass
+
+    error.UnsupportedAddressFamily = UnsupportedAddressFamily
 
 class SOCKSv5Reply(object):
     """



More information about the tor-commits mailing list