diff options
author | Corey Hulen <corey@hulen.com> | 2017-03-24 23:31:34 -0700 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-03-25 03:31:34 -0300 |
commit | 54d3d47daf9190275bbdaf8703b84969a4593451 (patch) | |
tree | 05899b296d0186c1a0da8a540bc486e34ad8eec9 /vendor/github.com/lib/pq/conn.go | |
parent | 7460302dec7796e01c98264e84bece8169cb6ed9 (diff) | |
download | chat-54d3d47daf9190275bbdaf8703b84969a4593451.tar.gz chat-54d3d47daf9190275bbdaf8703b84969a4593451.tar.bz2 chat-54d3d47daf9190275bbdaf8703b84969a4593451.zip |
PLT-6076 Adding viper libs for config file changes (#5871)
* Adding viper libs for config file changes
* Removing the old fsnotify lib
* updating some missing libs
Diffstat (limited to 'vendor/github.com/lib/pq/conn.go')
-rw-r--r-- | vendor/github.com/lib/pq/conn.go | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go index 4b2fb4462..c005cf9c4 100644 --- a/vendor/github.com/lib/pq/conn.go +++ b/vendor/github.com/lib/pq/conn.go @@ -98,7 +98,7 @@ type conn struct { namei int scratch [512]byte txnStatus transactionStatus - txnClosed chan<- struct{} + txnFinish func() // Save connection arguments to use during CancelRequest. dialer Dialer @@ -528,9 +528,8 @@ func (cn *conn) Begin() (_ driver.Tx, err error) { } func (cn *conn) closeTxn() { - if cn.txnClosed != nil { - close(cn.txnClosed) - cn.txnClosed = nil + if finish := cn.txnFinish; finish != nil { + finish() } } @@ -893,16 +892,9 @@ func (cn *conn) send(m *writeBuf) { } } -func (cn *conn) sendStartupPacket(m *writeBuf) { - // sanity check - if m.buf[0] != 0 { - panic("oops") - } - +func (cn *conn) sendStartupPacket(m *writeBuf) error { _, err := cn.c.Write((m.wrap())[1:]) - if err != nil { - panic(err) - } + return err } // Send a message of type typ to the server on the other end of cn. The @@ -1024,7 +1016,9 @@ func (cn *conn) ssl(o values) { w := cn.writeBuf(0) w.int32(80877103) - cn.sendStartupPacket(w) + if err := cn.sendStartupPacket(w); err != nil { + panic(err) + } b := cn.scratch[:1] _, err := io.ReadFull(cn.c, b) @@ -1085,7 +1079,9 @@ func (cn *conn) startup(o values) { w.string(v) } w.string("") - cn.sendStartupPacket(w) + if err := cn.sendStartupPacket(w); err != nil { + panic(err) + } for { t, r := cn.recv() @@ -1319,7 +1315,7 @@ func (cn *conn) parseComplete(commandTag string) (driver.Result, string) { type rows struct { cn *conn - closed chan<- struct{} + finish func() colNames []string colTyps []oid.Oid colFmts []format @@ -1330,8 +1326,8 @@ type rows struct { } func (rs *rows) Close() error { - if rs.closed != nil { - defer close(rs.closed) + if finish := rs.finish; finish != nil { + defer finish() } // no need to look at cn.bad as Next() will for { |