NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 4166


Ignore:
Timestamp:
Jul 24, 2009, 10:33:28 AM (8 years ago)
Author:
bless
Message:
  • fixed startup code for address assignment
Location:
ntlp/branches/20081127-merge-mobility-mk3/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ntlp/branches/20081127-merge-mobility-mk3/src/ntlp_main.cpp

    r4147 r4166  
    502502        addresses->add_host_prop(NULL, AddressList::ConfiguredAddr_P);
    503503    }
     504
     505    if (!ntlpv4addr.empty())
     506    {
     507            hostaddresslist_t::iterator it= ntlpv4addr.begin();
     508            while (it != ntlpv4addr.end())
     509            {
     510                    netaddress na(*it);
     511                    na.set_pref_len(32);
     512                    addresses->add_property(na, AddressList::ConfiguredAddr_P);
     513                    it++;
     514            } // end while
     515    }
     516
     517    if (!ntlpv6addr.empty())
     518    {
     519            hostaddresslist_t::iterator it= ntlpv6addr.begin();
     520           
     521            while (it != ntlpv6addr.end())
     522            {
     523                    netaddress na(*it);
     524                    na.set_pref_len(128);
     525                    addresses->add_property(na, AddressList::ConfiguredAddr_P);
     526                    it++;
     527            } // end while
     528    }
    504529   
    505     if (ntlpv4addr.size() != 0) {
    506         hostaddresslist_t::iterator it;
    507         for (it = ntlpv4addr.begin(); it != ntlpv4addr.end(); it++)
    508             addresses->add_property(dynamic_cast<netaddress &>(*it));
    509     }
    510 
    511     if (ntlpv6addr.size() != 0) {
    512         hostaddresslist_t::iterator it;
    513         for (it = ntlpv6addr.begin(); it != ntlpv6addr.end(); it++)
    514             addresses->add_property(dynamic_cast<netaddress &>(*it));
    515     }
    516 
    517530    // set specified IP addresses
    518531    ntlppar.addresses = addresses;
  • ntlp/branches/20081127-merge-mobility-mk3/src/ntlp_starter.cpp

    r4149 r4166  
    306306  peer_identity* mypi=new peer_identity();
    307307 
    308   EVLog(param.name, "Peer Identity initialized: " <<  color[magenta] << mypi << color[off]);
     308  EVLog(param.name, "Peer Identity initialized: " <<  color[magenta] << *mypi << color[off]);
    309309 
    310310  // ================================================================================================
     
    314314  AddressList *addresses= NULL;
    315315  if (param.addresses == 0) {
    316     addresses = new AddressList();
    317     hostaddresslist_t& ntlpv4addr= gconf.getparref< hostaddresslist_t >(gistconf_localaddrv4);
    318     hostaddresslist_t& ntlpv6addr= gconf.getparref< hostaddresslist_t >(gistconf_localaddrv6);
    319 
    320     if (!ntlpv4addr.empty())
    321     {
    322             hostaddresslist_t::iterator it= ntlpv4addr.begin();
    323             netaddress na;
    324             na.set_pref_len(32);
    325             while (it != ntlpv4addr.end())
    326             {
    327                     na= *it;
    328                     addresses->add_property(na, AddressList::ConfiguredAddr_P);
    329                     it++;
    330             } // end while
    331     }
    332 
    333     if (!ntlpv6addr.empty())
    334     {
    335             hostaddresslist_t::iterator it= ntlpv6addr.begin();
    336             netaddress na;
    337             na.set_pref_len(64);
    338            
    339             while (it != ntlpv6addr.end())
    340             {
    341                     na= *it;
    342                     addresses->add_property(na, AddressList::ConfiguredAddr_P);
    343                     it++;
    344             } // end while
    345     }
    346    
    347     if (ntlpv4addr.empty() && ntlpv6addr.empty())
    348             addresses->add_host_prop(NULL, AddressList::ConfiguredAddr_P);
     316          addresses = new AddressList();
     317          addresses->add_host_prop(NULL, AddressList::ConfiguredAddr_P);
    349318  }
    350319  else {
Note: See TracChangeset for help on using the changeset viewer.