Changeset 293

Show
Ignore:
Timestamp:
06/23/08 00:38:27 (2 months ago)
Author:
heyadayo
Message:

configuration for dispatch protocol added

Location:
branches/0.5/daemon/orbited
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/0.5/daemon/orbited/config.py

    r292 r293  
    2424 
    2525defaults = { 
     26    '[global]': { 
     27        'dispatch.enabled': '1', 
     28        'dispatch.port': '9000' 
     29    }, 
    2630    '[access]': [ 
    2731        ('localhost', 9998), # Allow WebSocket test daemon 
  • branches/0.5/daemon/orbited/dispatch.py

    r292 r293  
    22from twisted.internet.protocol import Protocol, Factory 
    33from twisted.internet import reactor 
     4from config import map as config 
     5from logger import get_logger 
    46 
    5  
     7logger = get_logger('Dispatch') 
    68 
    79class DispatchConnection(TCPConnection): 
     
    3638 
    3739    def __init__(self, *args, **kwargs): 
    38       TCPConnectionFactory.__init__(self, *args, **kwargs) 
    39       self.dispatch_connections = {} 
    40       self.factory = DispatchProtocolFactory(self) 
    41       reactor.listenTCP(9000, self.factory) 
     40        TCPConnectionFactory.__init__(self, *args, **kwargs) 
     41        self.dispatch_connections = {} 
     42        self.factory = DispatchProtocolFactory(self) 
     43        port = int(config['[global]']['dispatch.port']) 
     44        logger.info('Listening Orbit@%s (legacy dispatch protocol)' % port) 
     45        reactor.listenTCP(port, self.factory) 
    4246       
    4347    def receive_frame(self, conn, headers, body): 
     
    7074        self.root = root 
    7175        self.protocol = DispatchProtocol 
     76         
    7277    def buildProtocol(self, addr): 
     78        logger.access('Dispatch [ %s ] ' % (addr,)) 
    7379        return DispatchProtocol(self.root.receive_frame) 
    7480     
  • branches/0.5/daemon/orbited/start.py

    r292 r293  
    2424    root.putChild('binaryproxy', BinaryProxyFactory()) 
    2525    root.putChild('websocket', WebSocketFactory()) 
    26     root.putChild('legacy', DispatchFactory()) 
     26    if config['[global]']['dispatch.enabled'] == '1': 
     27        root.putChild('legacy', DispatchFactory()) 
     28         
    2729    for addr in config['[listen]']: 
    2830        url = urlparse.urlparse(addr)