mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	request LeaseSet from 3 floodfills
This commit is contained in:
		
							parent
							
								
									8d67c5ebcd
								
							
						
					
					
						commit
						38cb57a4c4
					
				
					 3 changed files with 19 additions and 12 deletions
				
			
		
							
								
								
									
										28
									
								
								NetDb.cpp
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								NetDb.cpp
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -335,19 +335,25 @@ namespace data
 | 
			
		|||
				if (inbound)
 | 
			
		||||
				{
 | 
			
		||||
					RequestedDestination * dest = CreateRequestedDestination (destination, isLeaseSet);
 | 
			
		||||
					auto floodfill = GetClosestFloodfill (destination, dest->GetExcludedPeers ());
 | 
			
		||||
					if (floodfill)
 | 
			
		||||
					std::vector<i2p::tunnel::TunnelMessageBlock> msgs;
 | 
			
		||||
					// request 3 closests floodfills
 | 
			
		||||
					for (int i = 0; i < 3; i++)
 | 
			
		||||
					{	
 | 
			
		||||
						auto floodfill = GetClosestFloodfill (destination, dest->GetExcludedPeers ());
 | 
			
		||||
						if (floodfill)
 | 
			
		||||
						{		
 | 
			
		||||
							// DatabaseLookup message
 | 
			
		||||
							msgs.push_back (i2p::tunnel::TunnelMessageBlock 
 | 
			
		||||
								{ 
 | 
			
		||||
									i2p::tunnel::eDeliveryTypeRouter,
 | 
			
		||||
									floodfill->GetIdentHash (), 0,
 | 
			
		||||
									dest->CreateRequestMessage (floodfill, inbound)
 | 
			
		||||
								});	
 | 
			
		||||
						}	
 | 
			
		||||
					}
 | 
			
		||||
					if (msgs.size () > 0)
 | 
			
		||||
					{	
 | 
			
		||||
						std::vector<i2p::tunnel::TunnelMessageBlock> msgs;
 | 
			
		||||
						// DatabaseLookup message
 | 
			
		||||
						dest->SetLastOutboundTunnel (outbound);
 | 
			
		||||
						msgs.push_back (i2p::tunnel::TunnelMessageBlock 
 | 
			
		||||
							{ 
 | 
			
		||||
								i2p::tunnel::eDeliveryTypeRouter,
 | 
			
		||||
								floodfill->GetIdentHash (), 0,
 | 
			
		||||
								dest->CreateRequestMessage (floodfill, inbound)
 | 
			
		||||
							});	
 | 
			
		||||
				
 | 
			
		||||
						outbound->SendTunnelDataMsg (msgs);	
 | 
			
		||||
					}	
 | 
			
		||||
					else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -409,7 +409,7 @@ namespace stream
 | 
			
		|||
		}	
 | 
			
		||||
		Sign (buf, size, buf+ size);
 | 
			
		||||
		size += 40; // signature
 | 
			
		||||
 | 
			
		||||
		LogPrint ("Local LeaseSet of ", tunnels.size (), " leases created");
 | 
			
		||||
		m->len += size + sizeof (I2NPDatabaseStoreMsg);
 | 
			
		||||
		FillI2NPMessageHeader (m, eI2NPDatabaseStore);
 | 
			
		||||
		return m;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,6 +131,7 @@ namespace tunnel
 | 
			
		|||
	
 | 
			
		||||
	void InboundTunnel::HandleTunnelDataMsg (I2NPMessage * msg)
 | 
			
		||||
	{
 | 
			
		||||
		if (IsFailed ()) SetFailed (false); // incoming messages means a tunnel is alive			
 | 
			
		||||
		msg->from = this;
 | 
			
		||||
		EncryptTunnelMsg (msg);
 | 
			
		||||
		m_Endpoint.HandleDecryptedTunnelDataMsg (msg);	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue