mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-09 09:50:30 +00:00
Fix protocol close test
This commit is contained in:
parent
116f232f5a
commit
92c1ce57a6
@ -5,6 +5,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHeaderFunctions(t *testing.T) {
|
func TestHeaderFunctions(t *testing.T) {
|
||||||
@ -172,7 +173,13 @@ func TestClose(t *testing.T) {
|
|||||||
c0 := NewConnection("c0", ar, bw, m0).(wireFormatConnection).next.(*rawConnection)
|
c0 := NewConnection("c0", ar, bw, m0).(wireFormatConnection).next.(*rawConnection)
|
||||||
NewConnection("c1", br, aw, m1)
|
NewConnection("c1", br, aw, m1)
|
||||||
|
|
||||||
c0.close(nil)
|
c0.close <- nil
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-c0.closed:
|
||||||
|
case <-time.After(1 * time.Second):
|
||||||
|
t.Fatal("Did not close within a second")
|
||||||
|
}
|
||||||
|
|
||||||
if !c0.isClosed() {
|
if !c0.isClosed() {
|
||||||
t.Fatal("Connection should be closed")
|
t.Fatal("Connection should be closed")
|
||||||
|
Loading…
Reference in New Issue
Block a user