viff

changeset 831:889882a2798b

Small code cleanup.
author Martin Geisler <mg@daimi.au.dk>
date Sun, 13 Jul 2008 23:58:53 +0200
parents a7fba43c2c6a
children dc276dba4113
files viff/runtime.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Sun Jul 13 23:38:22 2008 +0200
     1.2 +++ b/viff/runtime.py	Sun Jul 13 23:58:53 2008 +0200
     1.3 @@ -1534,18 +1534,18 @@
     1.4                  return self.ctx
     1.5  
     1.6          ctx_factory = SSLContextFactory(id)
     1.7 -        runtime.port = reactor.listenSSL(players[id].port, factory, ctx_factory)
     1.8 +        listen = lambda port: reactor.listenSSL(port, factory, ctx_factory)
     1.9 +        connect = lambda host, port: reactor.connectSSL(host, port, factory, ctx_factory)
    1.10      else:
    1.11          print "Not using SSL"
    1.12 -        runtime.port = reactor.listenTCP(players[id].port, factory)
    1.13 +        listen = lambda port: reactor.listenTCP(port, factory)
    1.14 +        connect = lambda host, port: reactor.connectTCP(host, port, factory)
    1.15  
    1.16 +    runtime.port = listen(players[id].port)
    1.17      for peer_id, player in players.iteritems():
    1.18          if peer_id > id:
    1.19              print "Will connect to %s" % player
    1.20 -            if options and options.ssl:
    1.21 -                reactor.connectSSL(player.host, player.port, factory, ctx_factory)
    1.22 -            else:
    1.23 -                reactor.connectTCP(player.host, player.port, factory)
    1.24 +            connect(player.host, player.port)
    1.25  
    1.26      return result
    1.27