Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 632e458

Browse files
author
Juanjo Alvarez
committed
Fix a condition where the quit channel of the tcp checker was not called
1 parent 597e39b commit 632e458

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

Diff for: internal/sockstate/sockstate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func GetInodeSockState(port int, inode uint64) (SockState, error) {
3636

3737
switch len(socks) {
3838
case 0:
39-
fallthrough
39+
return Broken, nil
4040
case 1:
4141
switch socks[0].State {
4242
case CloseWait:

Diff for: server/handler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ rowLoop:
239239

240240
if r.RowsAffected == rowsBatch {
241241
if err := callback(r); err != nil {
242+
close(quit)
242243
return err
243244
}
244245

@@ -272,13 +273,12 @@ rowLoop:
272273
}
273274
timer.Reset(waitTime)
274275
}
276+
close(quit)
275277

276278
if err := rows.Close(); err != nil {
277279
return err
278280
}
279281

280-
close(quit)
281-
282282
// Even if r.RowsAffected = 0, the callback must be
283283
// called to update the state in the go-vitess' listener
284284
// and avoid returning errors when the query doesn't

Diff for: server/handler_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ func TestHandlerKill(t *testing.T) {
165165
require.Len(handler.c, 2)
166166
require.Equal(conntainer1, handler.c[1])
167167
require.Equal(conntainer2, handler.c[2])
168-
169168
assertNoConnProcesses(t, e, conn2.ConnectionID)
170169

171170
ctx1 := handler.sm.NewContextWithQuery(conn1, "SELECT 1")

0 commit comments

Comments
 (0)