Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added method Reconnect()

  • Loading branch information...
commit 304278e6483aa0c1ab36e10445d6cfafc38b23a6 1 parent a7640ac
John Mac authored committed

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. +10 0 mongo/mongo.go
10 mongo/mongo.go
@@ -77,6 +77,16 @@ func (self *Connection) Disconnect() os.Error {
77 77 return nil
78 78 }
79 79
  80 +/* Reconnects using the same address `Addr`. */
  81 +func (self *Connection) Reconnect() (*Connection, os.Error) {
  82 + connection, err := ConnectByAddr(self.Addr)
  83 + if err != nil {
  84 + return nil, err
  85 + }
  86 +
  87 + return connection, nil
  88 +}
  89 +
80 90 func (c *Connection) writeMessage(m message) os.Error {
81 91 body := m.Bytes()
82 92 hb := header(int32(len(body)+16), m.RequestID(), 0, m.OpCode())

0 comments on commit 304278e

Please sign in to comment.
Something went wrong with that request. Please try again.