mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	PeerTest from Charlie to Alice
This commit is contained in:
		
							parent
							
								
									4fc3b8026a
								
							
						
					
					
						commit
						71168389ab
					
				
					 1 changed files with 18 additions and 13 deletions
				
			
		
							
								
								
									
										31
									
								
								SSU.cpp
									
										
									
									
									
								
							
							
						
						
									
										31
									
								
								SSU.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -791,22 +791,27 @@ namespace ssu
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// new test
 | 
								if (m_State == eSessionStateEstablished)
 | 
				
			||||||
			m_PeerTestNonces.insert (nonce);
 | 
					 | 
				
			||||||
			if (port)
 | 
					 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				LogPrint ("SSU peer test from Bob. We are Charlie");
 | 
									// new test
 | 
				
			||||||
				Send (PAYLOAD_TYPE_PEER_TEST, buf1, len); // back to Bob
 | 
									m_PeerTestNonces.insert (nonce);
 | 
				
			||||||
				SendPeerTest (nonce, be32toh (address), be16toh (port), introKey); // to Alice
 | 
									if (port)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										LogPrint ("SSU peer test from Bob. We are Charlie");
 | 
				
			||||||
 | 
										Send (PAYLOAD_TYPE_PEER_TEST, buf1, len); // back to Bob
 | 
				
			||||||
 | 
										SendPeerTest (nonce, be32toh (address), be16toh (port), introKey); // to Alice
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										LogPrint ("SSU peer test from Alice. We are Bob");
 | 
				
			||||||
 | 
										auto session = m_Server.GetRandomEstablishedSession (this); // charlie
 | 
				
			||||||
 | 
										if (session)
 | 
				
			||||||
 | 
											session->SendPeerTest (nonce, senderEndpoint.address ().to_v4 ().to_ulong (),
 | 
				
			||||||
 | 
												senderEndpoint.port (), introKey, false); 		
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
									LogPrint ("SSU peer test from Charlie. We are Alice");
 | 
				
			||||||
				LogPrint ("SSU peer test from Alice. We are Bob");
 | 
					 | 
				
			||||||
				auto session = m_Server.GetRandomEstablishedSession (this); // charlie
 | 
					 | 
				
			||||||
				if (session)
 | 
					 | 
				
			||||||
					session->SendPeerTest (nonce, senderEndpoint.address ().to_v4 ().to_ulong (),
 | 
					 | 
				
			||||||
						senderEndpoint.port (), introKey, false); 		
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}	
 | 
							}	
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue