[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,) addr = '[%s]' % (addr,)
else: else:
addr = '' addr = ''
r = (len(self.pool.getstarted('receiver')) try:
and "receiving" or "not receiving") r = (len(self.pool.getstarted('receiver'))
s = (len(self.pool.getstarted('sender')) and "receiving" or "not receiving")
and "sending" or "not sending") s = (len(self.pool.getstarted('sender'))
i = len(self.channelfactory.channels()) and "sending" or "not sending")
return "<%s%s %s/%s (%d active channels)>" %( 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) self.__class__.__name__, addr, r, s, i)
def _getremoteaddress(self): def _getremoteaddress(self):

View File

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