Skip to content

Commit 0ad0d03

Browse files
tangentalance6716
andauthored
set read deadline for new conection to fix handshake stuck (#861)
* set read deadline for new conection to fix handshake stuck * fix linter --------- Co-authored-by: lance6716 <[email protected]>
1 parent 226a501 commit 0ad0d03

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

replication/binlogsyncer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,9 @@ func (b *BinlogSyncer) newConnection(ctx context.Context) (*client.Conn, error)
900900
"", b.cfg.Dialer, func(c *client.Conn) {
901901
c.SetTLSConfig(b.cfg.TLSConfig)
902902
c.SetAttributes(map[string]string{"_client_role": "binary_log_listener"})
903+
if b.cfg.ReadTimeout > 0 {
904+
_ = c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout))
905+
}
903906
})
904907
}
905908

0 commit comments

Comments
 (0)