mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-10-31 17:25:06 +03:00 
			
		
		
		
	Remove double-block on router actor
This commit is contained in:
		
							parent
							
								
									326fdd4cf9
								
							
						
					
					
						commit
						ae8099819e
					
				
					 1 changed files with 10 additions and 8 deletions
				
			
		|  | @ -74,22 +74,24 @@ func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error) { | |||
| 		nodeMask[i] = 0xFF | ||||
| 	} | ||||
| 
 | ||||
| 	// TODO: This is all a mess | ||||
| 	var err error | ||||
| 	var session *sessionInfo | ||||
| 	phony.Block(c.sessions.router, func() { | ||||
| 		var ok bool | ||||
| 		session, ok = c.sessions.getByTheirPerm(boxPubKey) | ||||
| 		if !ok { | ||||
| 			nodeID, boxPubKey, err = c.sessions.router.core.Resolve(nodeID, nodeMask) | ||||
| 			if err == nil { | ||||
| 				session, _ = c.sessions.getByTheirPerm(boxPubKey) | ||||
| 			} | ||||
| 		} | ||||
| 	}) | ||||
| 	if !ok { | ||||
| 		nodeID, boxPubKey, err = c.sessions.router.core.Resolve(nodeID, nodeMask) | ||||
| 		if err == nil { | ||||
| 			phony.Block(c.sessions.router, func() { | ||||
| 				session, ok = c.sessions.getByTheirPerm(boxPubKey) | ||||
| 			}) | ||||
| 		} | ||||
| 	} | ||||
| 	if err != nil { | ||||
| 		return 0, fmt.Errorf("failed to find session/start search: %w", err) | ||||
| 	} | ||||
| 	if session == nil { | ||||
| 	if !ok || session == nil { | ||||
| 		return 0, errors.New("expected a session but there was none") | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neil Alexander
						Neil Alexander