mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Exchange MTU on wire
This commit is contained in:
		
							parent
							
								
									536974f20c
								
							
						
					
					
						commit
						11a7c5c458
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -429,12 +429,14 @@ func (p *sessionPing) encode() []byte {
 | 
				
			||||||
	bs = append(bs, wire_encode_uint64(wire_intToUint(p.tstamp))...)
 | 
						bs = append(bs, wire_encode_uint64(wire_intToUint(p.tstamp))...)
 | 
				
			||||||
	coords := wire_encode_coords(p.coords)
 | 
						coords := wire_encode_coords(p.coords)
 | 
				
			||||||
	bs = append(bs, coords...)
 | 
						bs = append(bs, coords...)
 | 
				
			||||||
 | 
						bs = append(bs, wire_encode_uint64(uint64(p.mtu))...)
 | 
				
			||||||
	return bs
 | 
						return bs
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (p *sessionPing) decode(bs []byte) bool {
 | 
					func (p *sessionPing) decode(bs []byte) bool {
 | 
				
			||||||
	var pType uint64
 | 
						var pType uint64
 | 
				
			||||||
	var tstamp uint64
 | 
						var tstamp uint64
 | 
				
			||||||
 | 
						var mtu uint64
 | 
				
			||||||
	switch {
 | 
						switch {
 | 
				
			||||||
	case !wire_chop_uint64(&pType, &bs):
 | 
						case !wire_chop_uint64(&pType, &bs):
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
| 
						 | 
					@ -449,11 +451,14 @@ func (p *sessionPing) decode(bs []byte) bool {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
	case !wire_chop_coords(&p.coords, &bs):
 | 
						case !wire_chop_coords(&p.coords, &bs):
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
 | 
						case !wire_chop_uint64(&mtu, &bs):
 | 
				
			||||||
 | 
							mtu = 1280
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	p.tstamp = wire_intFromUint(tstamp)
 | 
						p.tstamp = wire_intFromUint(tstamp)
 | 
				
			||||||
	if pType == wire_SessionPong {
 | 
						if pType == wire_SessionPong {
 | 
				
			||||||
		p.isPong = true
 | 
							p.isPong = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						p.mtu = uint16(mtu)
 | 
				
			||||||
	return true
 | 
						return true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue