Changeset 545

Show
Ignore:
Timestamp:
09/20/08 15:44:51 (4 months ago)
Author:
rgl
Message:

Merge the 0.7 branch into trunk.

For now on, trunk will contain the bleeding-edge version of Orbited.

Location:
trunk/daemon
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/daemon/orbited-debug.cfg

    r524 r545  
    22reactor=epoll 
    33proxy.enabled=1 
    4 session.ping_interval = 3 
    5 session.ping_timeout = 4 
     4session.ping_interval = 60 
     5session.ping_timeout = 70 
    66 
    77[listen] 
  • trunk/daemon/orbited/cometsession.py

    r536 r545  
    320320        if not self.open: 
    321321            self.open = True 
    322             self.packetId += 1 
    323322            self.cometTransport.sendPacket("open", self.packetId) 
    324323        self.cometTransport.flush() 
     
    373372        if ackId <= self.lastAckId: 
    374373            return 
    375         for i in range(ackId - self.lastAckId - 1): # -1 as the OPEN packet need not be ack'ed 
     374        for i in range(ackId - self.lastAckId): 
    376375            self.unackQueue.pop(0) 
    377376        self.lastAckId = ackId 
  • trunk/daemon/orbited/config.py

    r488 r545  
    5050    return True 
    5151 
    52 def setup(argv): 
     52defaultPaths = [ 
     53    os.path.join('/', 'etc', 'orbited.cfg'), 
     54    os.path.join('/', 'Program Files', 'Orbited', 'etc', 'orbited.cfg'), 
     55    'orbited.cfg', 
     56] 
     57 
     58def setup(argv, paths=defaultPaths): 
    5359    parser = OptionParser() 
    5460    parser.add_option( 
     
    6773    if not options.config: 
    6874        # no config file specified, try to search it. 
    69         paths = [ 
    70             os.path.join('/', 'etc', 'orbited.cfg'), 
    71             os.path.join('/', 'Program Files', 'Orbited', 'etc', 'orbited.cfg'), 
    72             'orbited.cfg', 
    73         ] 
    7475        for path in paths: 
    7576            if os.path.exists(path): 
  • trunk/daemon/orbited/start.py

    r417 r545  
    2626            logger.info('%s protocol active' % config_key) 
    2727 
    28 def _setup_static(root): 
     28def _setup_static(root, config): 
    2929    from twisted.web import static 
    30     for key, val in config.map['[static]'].items(): 
     30    for key, val in config['[static]'].items(): 
    3131        if key == 'INDEX': 
    3232            key = '' 
     
    6464 
    6565    _setup_protocols(root) 
    66     _setup_static(root) 
     66    _setup_static(root, config.map) 
     67    start_listening(site, config.map, logger) 
     68    reactor.run() 
    6769 
    68     for addr in config.map['[listen]']: 
     70def start_listening(site, config, logger): 
     71    from twisted.internet import reactor 
     72    for addr in config['[listen]']: 
    6973        url = urlparse.urlparse(addr) 
    7074        hostname = url.hostname or '' 
     
    7478        elif url.scheme == 'https': 
    7579            from twisted.internet import ssl 
    76             crt = config.map['[ssl]']['crt'] 
    77             key = config.map['[ssl]']['key'] 
     80            crt = config['[ssl]']['crt'] 
     81            key = config['[ssl]']['key'] 
    7882            try: 
    7983                ssl_context = ssl.DefaultOpenSSLContextFactory(key, crt) 
     
    8993            sys.exit(-1) 
    9094 
    91     reactor.run() 
    9295 
    9396if __name__ == "__main__": 
  • trunk/daemon/orbited/static/Orbited.js

    r541 r545  
     1 
    12// NOTE: to log/debug with Orbited, there are two methods: 
    23//          Use firebug  
     
    362363 
    363364 
    364  
     365Orbited.legacy = {} 
     366//Orbited.web.connect = function() { 
     367// 
     368//} 
    365369 
    366370Orbited.CometSession = function() { 
     
    589593;;;     self.logger.debug('transportOnClose'); 
    590594        if (self.readyState < self.READY_STATE_CLOSED) { 
    591             doClose(Orbited.Statuses.ServerClosedConnection) 
     595            try { 
     596                doClose(Orbited.Statuses.ServerClosedConnection) 
     597            } 
     598            catch(e) { 
     599//              Fix for navigation-close 
     600                return 
     601            } 
    592602        } 
    593603    }         
     
    11591169                        // If we got a 200, then we're in business 
    11601170                        if (status == 200) { 
    1161                             heartbeatTimer = window.setTimeout(heartbeatTimeout, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1171                            try { 
     1172                                heartbeatTimer = window.setTimeout(heartbeatTimeout, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1173                            } 
     1174                            catch(e) { 
     1175//                               Happens after navigation 
     1176                                 self.close() 
     1177                                 return 
     1178                            } 
    11621179                            var testtimer = heartbeatTimer; 
    11631180                        } 
     
    12411258//            self.logger.debug('do abort..') 
    12421259            xhr.abort(); 
    1243             window.clearTimeout(heartbeatTimer);             
     1260            window.clearTimeout(heartbeatTimer); 
    12441261        } 
    12451262        else { 
     
    13041321        window.clearTimeout(heartbeatTimer); 
    13051322;;;     self.logger.debug('clearing heartbeatTimer', heartbeatTimer) 
    1306         heartbeatTimer = window.setTimeout(function() {  
     1323        try { 
     1324            heartbeatTimer = window.setTimeout(function() {  
    13071325;;;         self.logger.debug('timer', testtimer, 'did it');  
    1308             heartbeatTimeout(); 
    1309         }, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1326                heartbeatTimeout(); 
     1327            }, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1328        } 
     1329        catch(e) { 
     1330             
     1331            return 
     1332        } 
    13101333        var testtimer = heartbeatTimer; 
    13111334 
     
    17721795            throw new Error("Already Connected") 
    17731796        } 
     1797        self.logger.debug('self.connect', _url) 
    17741798        url = new Orbited.URL(_url) 
    17751799        url.path += '/htmlfile' 
     
    17871811 
    17881812    var doOpen = function(_url) { 
     1813;;;     self.logger.debug('doOpen', _url) 
    17891814        htmlfile = new ActiveXObject('htmlfile'); // magical microsoft object 
    17901815        htmlfile.open(); 
     
    24932518} 
    24942519Orbited.JSON = JSON; 
     2520 
    24952521})(); 
  • trunk/daemon/orbited/transports/htmlfile.py

    r522 r545  
    1414            <html> 
    1515             <head> 
    16               <script src="../../static/HTMLFileFrame.js"></script> 
     16              <script src="../static/HTMLFileFrame.js"></script> 
    1717             </head> 
    1818             <body> 
     
    2929        self.request.setHeader('pragma', 'no-cache') 
    3030        self.request.setHeader('expires', '-1') 
     31        logger.debug('send initialData: ', self.initialData) 
    3132        self.request.write(self.initialData) 
    3233 
     
    3839        #      after they are executed. 
    3940        payload = '<script>e(%s)</script>' % (json.encode(packets),) 
     41        logger.debug('write ', payload) 
    4042        self.request.write(payload); 
    4143        self.totalBytes += len(payload) 
  • trunk/daemon/setup.py

    r540 r545  
    2222setup( 
    2323    name='orbited', 
    24     version='0.6.2', 
     24    version='0.7.0', 
    2525    author='Michael Carter', 
    2626    author_email='CarterMichael@gmail.com', 
     
    4343     
    4444    classifiers = [ 
    45         'Development Status :: 3 - Beta', 
     45        'Development Status :: 4 - Beta', 
    4646        'Environment :: Console', 
    4747        'Intended Audience :: Developers',