Skip to content

Commit

Permalink
Flow label test
Browse files Browse the repository at this point in the history
  • Loading branch information
vikulin committed Dec 22, 2023
1 parent 471cad9 commit 81727ae
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,17 @@ func (c *Core) ReadFrom(p []byte) (n int, from net.Addr, err error) {
if n == 0 {
continue
}
switch bs[0] {
switch bs[3] {
case typeSessionTraffic:
// This is what we want to handle here
case typeSessionProto:
data := append([]byte(nil), bs[1:n]...)
data := append([]byte(nil), bs[:n]...)
c.proto.handleProto(nil, from.(iwt.Addr), data)
continue
default:
continue
}
bs = bs[1:n]
copy(p, bs)
copy(p, bs[:n])
if len(p) < len(bs) {
n = len(p)
} else {
Expand All @@ -236,12 +235,9 @@ func (c *Core) ReadFrom(p []byte) (n int, from net.Addr, err error) {
func (c *Core) WriteTo(p []byte, addr net.Addr) (n int, err error) {
buf := allocBytes(0)
defer freeBytes(buf)
buf = append(buf, typeSessionTraffic)
buf = append(buf, p...)
buf[3] = typeSessionTraffic
n, err = c.PacketConn.WriteTo(buf, addr)
if n > 0 {
n -= 1
}
return
}

Expand Down

0 comments on commit 81727ae

Please sign in to comment.