mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	improve hosts.txt loading
This commit is contained in:
		
							parent
							
								
									a82bd628c1
								
							
						
					
					
						commit
						8725599d96
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -80,7 +80,7 @@ void AddressBook::LoadHosts ()
 | 
				
			||||||
		getline(f, s);
 | 
							getline(f, s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!s.length())
 | 
							if (!s.length())
 | 
				
			||||||
			break;
 | 
								continue; // skip empty line
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		size_t pos = s.find('=');
 | 
							size_t pos = s.find('=');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,8 +90,11 @@ void AddressBook::LoadHosts ()
 | 
				
			||||||
			std::string addr = s.substr(pos);
 | 
								std::string addr = s.substr(pos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Identity ident;
 | 
								Identity ident;
 | 
				
			||||||
			Base64ToByteStream (addr.c_str(), addr.length(), (uint8_t *)&ident, sizeof (ident));
 | 
								if (!ident.FromBase64(addr)) {
 | 
				
			||||||
			m_Addresses[name] = CalculateIdentHash (ident);	
 | 
									LogPrint ("hosts.txt: ignore ", name);
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								m_Addresses[name] = ident.Hash();
 | 
				
			||||||
			numAddresses++;
 | 
								numAddresses++;
 | 
				
			||||||
		}		
 | 
							}		
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue