This commit is contained in:
parent
486230768e
commit
129df0613b
@ -3273,6 +3273,12 @@ func TestConnCloseOnRestart(t *testing.T) {
|
|||||||
br := &testutils.BlockingRW{}
|
br := &testutils.BlockingRW{}
|
||||||
nw := &testutils.NoopRW{}
|
nw := &testutils.NoopRW{}
|
||||||
m.AddConnection(newFakeProtoConn(protocol.NewConnection(device1, br, nw, m, "testConn", protocol.CompressNever)), protocol.HelloResult{})
|
m.AddConnection(newFakeProtoConn(protocol.NewConnection(device1, br, nw, m, "testConn", protocol.CompressNever)), protocol.HelloResult{})
|
||||||
|
m.pmut.RLock()
|
||||||
|
if len(m.closed) != 1 {
|
||||||
|
t.Fatalf("Expected just one conn (len(m.conn) == %v)", len(m.conn))
|
||||||
|
}
|
||||||
|
closed := m.closed[device1]
|
||||||
|
m.pmut.RUnlock()
|
||||||
|
|
||||||
newFcfg := fcfg.Copy()
|
newFcfg := fcfg.Copy()
|
||||||
newFcfg.Paused = true
|
newFcfg.Paused = true
|
||||||
@ -3286,9 +3292,9 @@ func TestConnCloseOnRestart(t *testing.T) {
|
|||||||
case <-time.After(5 * time.Second):
|
case <-time.After(5 * time.Second):
|
||||||
t.Fatal("Timed out before folder restart returned")
|
t.Fatal("Timed out before folder restart returned")
|
||||||
}
|
}
|
||||||
m.pmut.RLock()
|
select {
|
||||||
defer m.pmut.RUnlock()
|
case <-closed:
|
||||||
if len(m.conn) != 0 {
|
case <-time.After(5 * time.Second):
|
||||||
t.Errorf("Conn wasn't removed on restart (len(m.conn) == %v)", len(m.conn))
|
t.Fatal("Timed out before connection was closed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user