[svn r37456] some small adjustments/cleanups regarding intiialisation

--HG--
branch : trunk
This commit is contained in:
hpk 2007-01-28 09:48:59 +01:00
parent c736976568
commit dad2da4583
2 changed files with 12 additions and 8 deletions

View File

@ -55,12 +55,16 @@ class Gateway(object):
addr = '[%s]' % (addr,)
else:
addr = ''
r = (len(self.pool.getstarted('receiver'))
and "receiving" or "not receiving")
s = (len(self.pool.getstarted('sender'))
and "sending" or "not sending")
i = len(self.channelfactory.channels())
return "<%s%s %s/%s (%d active channels)>" %(
try:
r = (len(self.pool.getstarted('receiver'))
and "receiving" or "not receiving")
s = (len(self.pool.getstarted('sender'))
and "sending" or "not sending")
i = len(self.channelfactory.channels())
except AttributeError:
r = s = "uninitialized"
i = "no"
return "<%s%s %s/%s (%s active channels)>" %(
self.__class__.__name__, addr, r, s, i)
def _getremoteaddress(self):

View File

@ -40,7 +40,7 @@ class InstallableGateway(gateway.Gateway):
gateway starts with odd numbers. This allows to
uniquely identify channels across both sides.
"""
bootstrap = ["we_are_remote=True", extra]
bootstrap = [extra]
bootstrap += [getsource(x) for x in startup_modules]
bootstrap += [io.server_stmt, "Gateway(io=io, startcount=2).join(joinexec=False)",]
source = "\n".join(bootstrap)
@ -135,7 +135,7 @@ class SocketGateway(InstallableGateway):
self.port = port = int(port)
sock.connect((host, port))
io = inputoutput.SocketIO(sock)
InstallableGateway.__init__(self, io=io)
super(SocketGateway, self).__init__(io=io)
def _getremoteaddress(self):
return '%s:%d' % (self.host, self.port)