mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Create a session on write if one does not exist
This commit is contained in:
		
							parent
							
								
									aed13e6d50
								
							
						
					
					
						commit
						41ce47d6d7
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -53,6 +53,9 @@ func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error) {
 | 
			
		|||
 | 
			
		||||
	session, ok := c.sessions.getByTheirPerm(boxPubKey)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		session = c.sessions.createSession(boxPubKey)
 | 
			
		||||
	}
 | 
			
		||||
	if session == nil {
 | 
			
		||||
		return 0, errors.New("expected a session but there was none")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue