~landscape/zope3/newer-from-ztk

« back to all changes in this revision

Viewing changes to src/twisted/conch/client/connect.py

  • Committer: Thomas Hervé
  • Date: 2009-07-08 13:52:04 UTC
  • Revision ID: thomas@canonical.com-20090708135204-df5eesrthifpylf8
Remove twisted copy

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2
 
# See LICENSE for details.
3
 
 
4
 
#
5
 
import direct, unix
6
 
 
7
 
connectTypes = {"direct" : direct.connect,
8
 
                "unix" : unix.connect}
9
 
 
10
 
def connect(host, port, options, verifyHostKey, userAuthObject):
11
 
    useConnects = options.conns or ['unix', 'direct']
12
 
    return _ebConnect(None, useConnects, host, port, options, verifyHostKey,
13
 
                      userAuthObject)
14
 
 
15
 
def _ebConnect(f, useConnects, host, port, options, vhk, uao):
16
 
    if not useConnects:
17
 
        return f
18
 
    connectType = useConnects.pop(0)
19
 
    f = connectTypes[connectType]
20
 
    d = f(host, port, options, vhk, uao)
21
 
    d.addErrback(_ebConnect, useConnects, host, port, options, vhk, uao)
22
 
    return d