From: fredrik Date: Wed, 22 Nov 2006 15:22:14 +0000 (+0000) Subject: Return filedes from mustconnect and cnl. X-Git-Tag: 0.3~174 X-Git-Url: http://dolda2000.com/gitweb/?a=commitdiff_plain;h=00ea20394f7910ae77782aab32d9bb975e6233fe;p=doldaconnect.git Return filedes from mustconnect and cnl. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@749 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/lib/python/dolcon/__init__.py b/lib/python/dolcon/__init__.py index b969028..d8a2b75 100644 --- a/lib/python/dolcon/__init__.py +++ b/lib/python/dolcon/__init__.py @@ -11,7 +11,7 @@ def login(useauthless = True, **kw): return result[0] def mustconnect(host, port = -1): - connect(host, port) + fd = connect(host, port) while True: resp = getresp() if resp is not None and resp.getcmd() == u".connect": @@ -19,16 +19,18 @@ def mustconnect(host, port = -1): select() if resp.getcode() != 200: raise RuntimeError, resp.intresp()[0][0] + return fd def cnl(host = None, port = -1, useauthless = True, **kw): if host is None: host = os.getenv("DCSERVER") if host is None: raise ValueError, "No DC host to connect to" - mustconnect(host, port) + fd = mustconnect(host, port) err, reason = login(useauthless, **kw) if err != "success": raise RuntimeError, (err, reason) + return fd def ecmd(*args): tag = qcmd(*args)