mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	handle SILENT for STREAM FORWARD
This commit is contained in:
		
							parent
							
								
									b35f43d79e
								
							
						
					
					
						commit
						e41bbcb2bb
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -608,6 +608,8 @@ namespace client
 | 
			
		|||
		m_SocketType = eSAMSocketTypeForward;
 | 
			
		||||
		m_ID = id;
 | 
			
		||||
		m_IsAccepting = true;
 | 
			
		||||
		std::string& silent = params[SAM_PARAM_SILENT];
 | 
			
		||||
		if (silent == SAM_VALUE_TRUE) m_IsSilent = true;
 | 
			
		||||
		session->localDestination->AcceptStreams (std::bind (&SAMSocket::HandleI2PForward, 
 | 
			
		||||
			shared_from_this (), std::placeholders::_1, ep));
 | 
			
		||||
		SendMessageReply (SAM_STREAM_STATUS_OK, strlen(SAM_STREAM_STATUS_OK), false);			
 | 
			
		||||
| 
						 | 
				
			
			@ -982,7 +984,17 @@ namespace client
 | 
			
		|||
						s->m_Owner.AddSocket (newSocket);
 | 
			
		||||
						newSocket->Receive ();
 | 
			
		||||
						newSocket->m_Stream = stream;
 | 
			
		||||
						newSocket->I2PReceive ();
 | 
			
		||||
						newSocket->m_ID = s->m_ID;
 | 
			
		||||
						if (!s->m_IsSilent)
 | 
			
		||||
						{
 | 
			
		||||
							// get remote peer address
 | 
			
		||||
							auto dest = stream->GetRemoteIdentity()->ToBase64 ();
 | 
			
		||||
							memcpy (newSocket->m_StreamBuffer, dest.c_str (), dest.length ());
 | 
			
		||||
							newSocket->m_StreamBuffer[dest.length ()] = '\n';
 | 
			
		||||
							newSocket->HandleI2PReceive (boost::system::error_code (),dest.length () + 1); // we send identity like it has been received from stream
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
							newSocket->I2PReceive ();
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
						stream->AsyncClose ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue