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

Commit

Permalink
Revert "Try wait for only one direction"
Browse files Browse the repository at this point in the history
This reverts commit 34c3ad7.
  • Loading branch information
bzEq committed Apr 26, 2024
1 parent 34c3ad7 commit ff1c40d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions core/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@ func (self *SimpleSwitch) Run() {
defer close(self.done[1])
self.switchTraffic(self.port[1], self.port[0])
}()
select {
case <-self.done[0]:
return
case <-self.done[1]:
return
}
<-self.done[0]
<-self.done[1]
}

func (self *SimpleSwitch) switchTraffic(in, out Port) {
for {
var b iovec.IoVec
if err := in.Unpack(&b); err != nil {
if err != io.EOF {
if err == io.EOF {
out.CloseWrite()
} else {
log.Println(err)
}
return
Expand Down

0 comments on commit ff1c40d

Please sign in to comment.