Skip to content

Commit bf7f34f

Browse files
shogo82148julienschmidt
authored andcommitted
Start the watcher after handshake (go-sql-driver#627)
Fixes go-sql-driver#626
1 parent 8fefef0 commit bf7f34f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

driver.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
6666
mc.parseTime = mc.cfg.ParseTime
6767
mc.strict = mc.cfg.Strict
6868

69-
// Call startWatcher for context support (From Go 1.8)
70-
if s, ok := interface{}(mc).(watcher); ok {
71-
s.startWatcher()
72-
}
73-
7469
// Connect to Server
7570
if dial, ok := dials[mc.cfg.Net]; ok {
7671
mc.netConn, err = dial(mc.cfg.Addr)
@@ -92,6 +87,11 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
9287
}
9388
}
9489

90+
// Call startWatcher for context support (From Go 1.8)
91+
if s, ok := interface{}(mc).(watcher); ok {
92+
s.startWatcher()
93+
}
94+
9595
mc.buf = newBuffer(mc.netConn)
9696

9797
// Set I/O timeouts

0 commit comments

Comments
 (0)