summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-sql-driver/mysql/driver.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-sql-driver/mysql/driver.go')
-rw-r--r--vendor/github.com/go-sql-driver/mysql/driver.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/vendor/github.com/go-sql-driver/mysql/driver.go b/vendor/github.com/go-sql-driver/mysql/driver.go
index 1a75a16ecf..9f4967087f 100644
--- a/vendor/github.com/go-sql-driver/mysql/driver.go
+++ b/vendor/github.com/go-sql-driver/mysql/driver.go
@@ -23,11 +23,6 @@ import (
"sync"
)
-// watcher interface is used for context support (From Go 1.8)
-type watcher interface {
- startWatcher()
-}
-
// MySQLDriver is exported to make the driver directly accessible.
// In general the driver is used via the database/sql package.
type MySQLDriver struct{}
@@ -55,7 +50,7 @@ func RegisterDial(net string, dial DialFunc) {
// Open new Connection.
// See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how
-// the DSN string is formated
+// the DSN string is formatted
func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
var err error
@@ -82,6 +77,10 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
mc.netConn, err = nd.Dial(mc.cfg.Net, mc.cfg.Addr)
}
if err != nil {
+ if nerr, ok := err.(net.Error); ok && nerr.Temporary() {
+ errLog.Print("net.Error from Dial()': ", nerr.Error())
+ return nil, driver.ErrBadConn
+ }
return nil, err
}
@@ -96,9 +95,7 @@ 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.startWatcher()
mc.buf = newBuffer(mc.netConn)
@@ -112,20 +109,23 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
mc.cleanup()
return nil, err
}
+ if plugin == "" {
+ plugin = defaultAuthPlugin
+ }
// Send Client Authentication Packet
- authResp, addNUL, err := mc.auth(authData, plugin)
+ authResp, err := mc.auth(authData, plugin)
if err != nil {
// try the default auth plugin, if using the requested plugin failed
errLog.Print("could not use requested auth plugin '"+plugin+"': ", err.Error())
plugin = defaultAuthPlugin
- authResp, addNUL, err = mc.auth(authData, plugin)
+ authResp, err = mc.auth(authData, plugin)
if err != nil {
mc.cleanup()
return nil, err
}
}
- if err = mc.writeHandshakeResponsePacket(authResp, addNUL, plugin); err != nil {
+ if err = mc.writeHandshakeResponsePacket(authResp, plugin); err != nil {
mc.cleanup()
return nil, err
}