Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Do not log EOF && Do not CloseRead
Browse files Browse the repository at this point in the history
  • Loading branch information
bzEq committed Apr 25, 2024
1 parent 3cb0eab commit 4f45a99
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package core

import (
"io"
"log"

"github.com/bzEq/bx/core/iovec"
Expand Down Expand Up @@ -31,13 +32,15 @@ func (self *SimpleSwitch) switchTraffic(in, out Port) {
for {
var b iovec.IoVec
if err := in.Unpack(&b); err != nil {
log.Println(err)
out.CloseWrite()
if err == io.EOF {
out.CloseWrite()
} else {
log.Println(err)
}
return
}
if err := out.Pack(&b); err != nil {
log.Println(err)
in.CloseRead()
return
}
}
Expand Down

0 comments on commit 4f45a99

Please sign in to comment.