mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
This commit is contained in:
parent
486230768e
commit
129df0613b
@ -3273,6 +3273,12 @@ func TestConnCloseOnRestart(t *testing.T) {
|
||||
br := &testutils.BlockingRW{}
|
||||
nw := &testutils.NoopRW{}
|
||||
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.Paused = true
|
||||
@ -3286,9 +3292,9 @@ func TestConnCloseOnRestart(t *testing.T) {
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatal("Timed out before folder restart returned")
|
||||
}
|
||||
m.pmut.RLock()
|
||||
defer m.pmut.RUnlock()
|
||||
if len(m.conn) != 0 {
|
||||
t.Errorf("Conn wasn't removed on restart (len(m.conn) == %v)", len(m.conn))
|
||||
select {
|
||||
case <-closed:
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatal("Timed out before connection was closed")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user