mirror of https://github.com/cbeuw/Cloak
fix stale code
This commit is contained in:
parent
a82a1a5627
commit
4351815a4a
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -35,7 +34,7 @@ func (d *datagramBuffer) Read(target []byte) (int, error) {
|
||||||
d.buf = new(bytes.Buffer)
|
d.buf = new(bytes.Buffer)
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
if atomic.LoadUint32(&d.closed) == 1 && len(d.pLens) == 0 {
|
if d.closed && len(d.pLens) == 0 {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package multiplex
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"sync/atomic"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
@ -67,7 +66,7 @@ func TestDatagramBuffer_RW(t *testing.T) {
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if atomic.LoadUint32(&pipe.closed) != 1 {
|
if !pipe.closed {
|
||||||
t.Error("expecting closed pipe, not closed")
|
t.Error("expecting closed pipe, not closed")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue