mongoid/moped — pull request #113 by jonson (2012-11-16 00:07:25+00:00)
Title: node.peers nil

I'm attempting to move from mongo-ruby-driver to moped and came across this issue that was crashing my app, attached is my quick fix that got me working. Not sure if this is the best way, I have no idea why node.peers is nil, that's some pretty gnarly code in there, way beyond my ruby skills.

I'm using a replicaset with that requires authentication, with the following config:
```json
{
"_id" : "rs0",
"version" : 6,
"members" : [
{
"_id" : 0,
"host" : "mongo:27017"
},
{
"_id" : 1,
"host" : "mongo2:27017",
"priority" : 0
},
{
"_id" : 2,
"host" : "load:27017",
"arbiterOnly" : true
}
]
}
```

The server is running mongo 2.0.7.

My dev env setup is a bit weird (I have a ssh tunnel to my mongo server and a host entry for 'mongo' pointing to localhost), where I can't resolve the secondary servers ('mongo2', 'load'), this is where I noticed the issue.

I'm connecting with the config:
```ruby
Moped::Session.new(["localhost:27017"])
```

The driver rightfully spits out a few warnings then dies with this trace:
```
W, [2012-11-15T19:03:08.559313 #62791] WARN -- : MOPED: Could not resolve IP address for mongo2:27017
W, [2012-11-15T19:03:08.559560 #62791] WARN -- : MOPED: Could not resolve IP address for load:27017
W, [2012-11-15T19:03:08.559780 #62791] WARN -- : MOPED: Could not resolve IP address for mongo2:27017
[2012-11-16T00:03:08Z] WARN -- vines: Error updating the blacklist: undefined method `-' for nil:NilClass
[2012-11-16T00:03:08Z] DEBUG -- vines: /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:172:in `block in refresh'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:172:in `each'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:172:in `block in refresh'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:179:in `each'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:179:in `refresh'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:132:in `nodes'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cluster.rb:240:in `with_secondary'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/session/context.rb:104:in `with_node'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cursor.rb:115:in `load_docs'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/cursor.rb:25:in `each'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/query.rb:77:in `each'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/moped-9fb8262c5425/lib/moped/query.rb:77:in `each'
```