mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	apparently it was these callbacks that were sometimes deadlocking things
This commit is contained in:
		
							parent
							
								
									9ce7fe2e3f
								
							
						
					
					
						commit
						5a02e2ff44
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -140,7 +140,7 @@ func (s *searches) doSearchStep(sinfo *searchInfo) {
 | 
				
			||||||
	if len(sinfo.toVisit) == 0 {
 | 
						if len(sinfo.toVisit) == 0 {
 | 
				
			||||||
		// Dead end, do cleanup
 | 
							// Dead end, do cleanup
 | 
				
			||||||
		delete(s.searches, sinfo.dest)
 | 
							delete(s.searches, sinfo.dest)
 | 
				
			||||||
		sinfo.callback(nil, errors.New("search reached dead end"))
 | 
							go sinfo.callback(nil, errors.New("search reached dead end"))
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Send to the next search target
 | 
						// Send to the next search target
 | 
				
			||||||
| 
						 | 
					@ -203,7 +203,7 @@ func (s *searches) checkDHTRes(info *searchInfo, res *dhtRes) bool {
 | 
				
			||||||
		sinfo = s.core.sessions.createSession(&res.Key)
 | 
							sinfo = s.core.sessions.createSession(&res.Key)
 | 
				
			||||||
		if sinfo == nil {
 | 
							if sinfo == nil {
 | 
				
			||||||
			// nil if the DHT search finished but the session wasn't allowed
 | 
								// nil if the DHT search finished but the session wasn't allowed
 | 
				
			||||||
			info.callback(nil, errors.New("session not allowed"))
 | 
								go info.callback(nil, errors.New("session not allowed"))
 | 
				
			||||||
			return true
 | 
								return true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		_, isIn := s.core.sessions.getByTheirPerm(&res.Key)
 | 
							_, isIn := s.core.sessions.getByTheirPerm(&res.Key)
 | 
				
			||||||
| 
						 | 
					@ -215,7 +215,7 @@ func (s *searches) checkDHTRes(info *searchInfo, res *dhtRes) bool {
 | 
				
			||||||
	sinfo.coords = res.Coords
 | 
						sinfo.coords = res.Coords
 | 
				
			||||||
	sinfo.packet = info.packet
 | 
						sinfo.packet = info.packet
 | 
				
			||||||
	s.core.sessions.ping(sinfo)
 | 
						s.core.sessions.ping(sinfo)
 | 
				
			||||||
	info.callback(sinfo, nil)
 | 
						go info.callback(sinfo, nil)
 | 
				
			||||||
	// Cleanup
 | 
						// Cleanup
 | 
				
			||||||
	delete(s.searches, res.Dest)
 | 
						delete(s.searches, res.Dest)
 | 
				
			||||||
	return true
 | 
						return true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue