mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	when we abandon a link because we already have a connection to that peer, only wait for the connection to close if it's an *outgoing* link, otherwise incomming connection attempts can cause us to leak links
This commit is contained in:
		
							parent
							
								
									70a118ae98
								
							
						
					
					
						commit
						46c5df1c23
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -179,7 +179,10 @@ func (intf *linkInterface) handler() error {
 | 
				
			||||||
		// That lets them do things like close connections on its own, avoid printing a connection message in the first place, etc.
 | 
							// That lets them do things like close connections on its own, avoid printing a connection message in the first place, etc.
 | 
				
			||||||
		intf.link.core.log.Debugln("DEBUG: found existing interface for", intf.name)
 | 
							intf.link.core.log.Debugln("DEBUG: found existing interface for", intf.name)
 | 
				
			||||||
		intf.msgIO.close()
 | 
							intf.msgIO.close()
 | 
				
			||||||
		<-oldIntf.closed
 | 
							if !intf.incoming {
 | 
				
			||||||
 | 
								// Block outgoing connection attempts until the existing connection closes
 | 
				
			||||||
 | 
								<-oldIntf.closed
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		intf.closed = make(chan struct{})
 | 
							intf.closed = make(chan struct{})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue