Skip to content
Browse files

Added method Reconnect()

  • Loading branch information...
1 parent a7640ac commit 304278e6483aa0c1ab36e10445d6cfafc38b23a6 John Mac committed with Jun 18, 2010
Showing with 10 additions and 0 deletions.
  1. +10 −0 mongo/mongo.go
View
10 mongo/mongo.go
@@ -77,6 +77,16 @@ func (self *Connection) Disconnect() os.Error {
return nil
}
+/* Reconnects using the same address `Addr`. */
+func (self *Connection) Reconnect() (*Connection, os.Error) {
+ connection, err := ConnectByAddr(self.Addr)
+ if err != nil {
+ return nil, err
+ }
+
+ return connection, nil
+}
+
func (c *Connection) writeMessage(m message) os.Error {
body := m.Bytes()
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.