From 71a53597ac5270339ff2578450bd7bb1006f76a8 Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Wed, 28 Jun 2017 19:44:46 +0900 Subject: [PATCH] start the watcher after handshake. fix #626 --- driver.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/driver.go b/driver.go index f11e14462..c341b6680 100644 --- a/driver.go +++ b/driver.go @@ -66,11 +66,6 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) { mc.parseTime = mc.cfg.ParseTime mc.strict = mc.cfg.Strict - // Call startWatcher for context support (From Go 1.8) - if s, ok := interface{}(mc).(watcher); ok { - s.startWatcher() - } - // Connect to Server if dial, ok := dials[mc.cfg.Net]; ok { mc.netConn, err = dial(mc.cfg.Addr) @@ -92,6 +87,11 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) { } } + // Call startWatcher for context support (From Go 1.8) + if s, ok := interface{}(mc).(watcher); ok { + s.startWatcher() + } + mc.buf = newBuffer(mc.netConn) // Set I/O timeouts