Added 'dontResolve' keyword to Socket.connect, which if set

to True, will prevent the hostname lookup. This gives
the caller the option of passing in a physical destination
base64, instead of being limited to known hosts.
This commit is contained in:
aum
2004-07-30 17:43:39 +00:00
committed by zzz
parent 15d58ecdcd
commit cc85a00bfd

View File

@ -238,7 +238,21 @@ class Socket:
pass
self.closed = True
def connect(self, address):
def connect(self, address, **kw):
"""
Attempts to connect to a remote dest, identified in local
SAM bridge's hosts file as host 'address'.
For example:
s.connect("duck.i2p")
You can pass a keyword 'dontResolve', which if true,
allows you to pass the base64 destination as the address, and
override the hostname lookup.
For example:
s.connect("238797sdfh2k34kjh....AAAA")
"""
# Synchronized. Lock prevents two connects from occurring at the
# same time in different threads.
self.lock.acquire()
@ -249,6 +263,10 @@ class Socket:
return
self._verify_not_connected()
# patched by aum - allow caller to pass in raw base64 dest,
# and prevent the name lookup attempt
if not kw.get('dontResolve', 1):
address = resolve(address, self.samaddr)
timeout = self.timeout