Skip to content

Commit

Permalink
set read deadline for new conection to fix handshake stuck (go-mysql-…
Browse files Browse the repository at this point in the history
…org#861)

* set read deadline for new conection to fix handshake stuck

* fix linter

---------

Co-authored-by: lance6716 <[email protected]>
  • Loading branch information
tangenta and lance6716 authored May 7, 2024
1 parent 226a501 commit 0ad0d03
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions replication/binlogsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,9 @@ func (b *BinlogSyncer) newConnection(ctx context.Context) (*client.Conn, error)
"", b.cfg.Dialer, func(c *client.Conn) {
c.SetTLSConfig(b.cfg.TLSConfig)
c.SetAttributes(map[string]string{"_client_role": "binary_log_listener"})
if b.cfg.ReadTimeout > 0 {
_ = c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout))
}
})
}

Expand Down

0 comments on commit 0ad0d03

Please sign in to comment.