def _getConnection(self):
        if self._proto is not None:
            return defer.succeed(self._proto)
        d = defer.Deferred(self._cancel)
        self._waiting.append(d)
        if not self._connecting:
            self._connecting = True
            self._connectionDeferred = (
                self.endpoint.connect(self)
                .addBoth(self._gotResult)
                .addErrback(log.err, 'error connecting %r' % (self,)))
        return d
dataset/ETHPy150Open flowroute/txjason/txjason/netstring.py/JSONRPCClientFactory._getConnection/original