                     c(undefined, socket)
 
                 @_socket = socket
+            cancel_connecting()
 
     # Get a new connection to the local_hub,
     # authenticated via the secret_token, and enhanced

        misc_node.keep_portforward_alive(opts.port)

_local_hub_cache = {}
new_local_hub = (opts) ->    # cb(err, hub)
    opts = defaults opts,
        project_id : required
        cb         : required

    hash = opts.project_id
    H    = _local_hub_cache[hash]

    if H?
        winston.debug("new_local_hub (#{opts.project_id}) -- using cached version")
        opts.cb(false, H)
    else
        start_time = misc.walltime()
        new LocalHub opts.project_id, (err, H) ->
            if err
                opts.cb(err)
            else
                _local_hub_cache[hash] = H
                opts.cb(undefined, H)

class LocalHub  # use the function "new_local_hub" above; do not construct this directly!
    constructor: (@project_id, cb) ->
        @_sockets = {}
        @_multi_response = {}
        @path = '.'    # should deprecate - *is* used by some random code elsewhere in this file
        @dbg("getting deployed running project")
        @project = bup_server.get_project(@project_id)
        cb(undefined, @)

    dbg: (m) =>
        winston.debug("local_hub(#{@project_id}): #{misc.to_json(m)}")

                    cb          : cb
            (cb) =>
                dbg("start project opening so that when user tries to open it in a moment it opens more quickly")
                hub = new_local_hub(project_id)
                hub.local_hub_socket (err, socket) =>
                    if err
                        dbg("failed to open socket -- #{err}")
                    else
                        dbg("opened socket")
                cb() # don't wait for socket to open!
        ], (err) =>
            if err
                dbg("error; project #{project_id} -- #{err}")
