mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 00:20:46 +00:00 
			
		
		
		
	use unique_ptr for incomplete message
This commit is contained in:
		
							parent
							
								
									0dac2a74d3
								
							
						
					
					
						commit
						408a67f34f
					
				
					 2 changed files with 7 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -48,7 +48,7 @@ namespace transport
 | 
			
		|||
 | 
			
		||||
	struct FragmentCmp
 | 
			
		||||
	{
 | 
			
		||||
		bool operator() (const Fragment * f1, const Fragment * f2) const
 | 
			
		||||
		bool operator() (const std::unique_ptr<Fragment>& f1, const std::unique_ptr<Fragment>& f2) const
 | 
			
		||||
  		{	
 | 
			
		||||
			return f1->fragmentNum < f2->fragmentNum; 
 | 
			
		||||
		};
 | 
			
		||||
| 
						 | 
				
			
			@ -58,10 +58,10 @@ namespace transport
 | 
			
		|||
	{
 | 
			
		||||
		I2NPMessage * msg;
 | 
			
		||||
		int nextFragmentNum;	
 | 
			
		||||
		std::set<Fragment *, FragmentCmp> savedFragments;
 | 
			
		||||
		std::set<std::unique_ptr<Fragment>, FragmentCmp> savedFragments;
 | 
			
		||||
		
 | 
			
		||||
		IncompleteMessage (I2NPMessage * m): msg (m), nextFragmentNum (0) {};
 | 
			
		||||
		~IncompleteMessage () { for (auto it: savedFragments) { delete it; }; };
 | 
			
		||||
		~IncompleteMessage () { if (msg) DeleteI2NPMessage (msg); };
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	struct SentMessage
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue