| From bc7e9366334b46f8f89f8fedf732ee7d68421604 Mon Sep 17 00:00:00 2001 |
| From: pzm <pzm@google.com> |
| Date: Mon, 2 Nov 2015 18:40:09 -0800 |
| Subject: [PATCH] Support multiple call to Conn.Close(). |
| |
| --- |
| conn.go | 8 ++++++-- |
| 1 file changed, 6 insertions(+), 2 deletions(-) |
| |
| diff --git a/conn.go b/conn.go |
| index a1437d7..7815039 100644 |
| --- a/conn.go |
| +++ b/conn.go |
| @@ -57,8 +57,12 @@ func NewClientConn(ctx *Context, conn net.Conn) (*Conn, error) { |
| return sslConn, nil |
| } |
| func (self *Conn) Close() error { |
| - return self.ssl.Shutdown() |
| - |
| + if self.ssl != nil { |
| + err := self.ssl.Shutdown() |
| + self.ssl = nil |
| + return err |
| + } |
| + return nil |
| } |
| func (self *Conn) LocalAddr() net.Addr { |
| return self.conn.LocalAddr() |
| -- |
| 2.6.0.rc2.230.g3dd15c0 |
| |