Browse Source

lib/model: Readd special handling of conn close in TestIssue5063 (#5743)

This partially reverts commit 64518b0f7e74ad5f6d42f9a3b6ffc1f74b61c2f0.
Simon Frei 6 years ago
parent
commit
d91da8feee
1 changed files with 10 additions and 0 deletions
  1. 10 0
      lib/model/model_test.go

+ 10 - 0
lib/model/model_test.go

@@ -862,6 +862,16 @@ func TestIssue5063(t *testing.T) {
 	m := newState(defaultAutoAcceptCfg)
 	defer cleanupModel(m)
 
+	m.pmut.Lock()
+	for _, c := range m.conn {
+		conn := c.(*fakeConnection)
+		conn.mut.Lock()
+		conn.closeFn = func(_ error) {}
+		conn.mut.Unlock()
+		defer m.Closed(c, errStopped) // to unblock deferred m.Stop()
+	}
+	m.pmut.Unlock()
+
 	wg := sync.WaitGroup{}
 
 	addAndVerify := func(id string) {