mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	make dial fail if a session to the same node already exists, fixes race between simultaneous connections to a node's 200 address and one of its 300 addresses, should also fix races between a search and an accepted listen
This commit is contained in:
		
							parent
							
								
									730fd08954
								
							
						
					
					
						commit
						8c52ccadf9
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -204,6 +204,11 @@ func (sinfo *searchInfo) checkDHTRes(res *dhtRes) bool {
 | 
				
			||||||
		if !isIn {
 | 
							if !isIn {
 | 
				
			||||||
			panic("This should never happen")
 | 
								panic("This should never happen")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							sinfo.callback(nil, errors.New("session already exists"))
 | 
				
			||||||
 | 
							// Cleanup
 | 
				
			||||||
 | 
							delete(sinfo.searches.searches, res.Dest)
 | 
				
			||||||
 | 
							return true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// FIXME (!) replay attacks could mess with coords? Give it a handle (tstamp)?
 | 
						// FIXME (!) replay attacks could mess with coords? Give it a handle (tstamp)?
 | 
				
			||||||
	sess.coords = res.Coords
 | 
						sess.coords = res.Coords
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue