Changeset 189

Show
Ignore:
Timestamp:
03/06/06 15:27:10 (2 years ago)
Author:
dsandler
Message:

Fix NPE when using -N (new network) flag.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedtree/trunk/src/net/feedtree/core/client/Client.java

    r184 r189  
    280280                    + localHost + " port " + port + "]"); 
    281281             
     282            try { 
     283 
     284                // Construct the node factory given the *local* 
     285                // address to bind to (this allows us to select among 
     286                // multiple network interfaces on the client).  Note 
     287                // that we're not yet using the (detected) external 
     288                // IP; that comes later. 
     289                factory = new SocketPastryNodeFactory( 
     290                    new RandomNodeIdFactory(g_pastryEnv), 
     291                    localHost, port, g_pastryEnv); 
     292 
     293            } catch (IOException exc) { 
     294                Logger.global.severe("error: couldn't create node factory; bailing"); 
     295                status.notifyStatus(ClientStatus.STATUS_FATAL_ERROR,  
     296                        "Error loading Pastry network code"); 
     297                 
     298                return null; 
     299            } 
     300         
    282301            if (bootHost != "") { 
    283302                // NAT-detection code loosely cribbed from ePOST 
     
    304323                        g_publicNodeAddress = new InetSocketAddress(natAddr, port); 
    305324         
    306                     try { 
    307  
    308                         // Construct the node factory given the *local* 
    309                         // address to bind to (this allows us to select among 
    310                         // multiple network interfaces on the client).  Note 
    311                         // that we're not yet using the (detected) external 
    312                         // IP; that comes later. 
    313                         factory = new SocketPastryNodeFactory( 
    314                             new RandomNodeIdFactory(g_pastryEnv), 
    315                             natAddr, port, g_pastryEnv); 
    316  
    317                     } catch (IOException exc) { 
    318                         Logger.global.severe("error: couldn't create node factory; bailing"); 
    319                         status.notifyStatus(ClientStatus.STATUS_FATAL_ERROR,  
    320                                 "Error loading Pastry network code"); 
    321                          
    322                         return null; 
    323                     } 
    324                  
    325325                    Logger.global.fine("[Contacting bootstrap host " 
    326326                        + bootHost + ":" + bootPort + "]"); 
     
    375375                status.notifyStatus(ClientStatus.STATUS_STARTING, 
    376376                        "Starting new network"); 
    377                     
     377     
    378378                node = factory.newNode(null); 
    379379