RUBY-386 extend ismaster timeout to Connection

This commit is contained in:
Kyle Banker 2011-12-13 15:03:00 -05:00
parent c308f9b025
commit 8fd89eb2a4
1 changed files with 7 additions and 1 deletions

View File

@ -615,7 +615,13 @@ module Mongo
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
end
config = self['admin'].command({:ismaster => 1}, :socket => socket)
if @connect_timeout
Mongo::TimeoutHandler.timeout(@connect_timeout, OperationTimeout) do
config = self['admin'].command({:ismaster => 1}, :socket => socket)
end
else
config = self['admin'].command({:ismaster => 1}, :socket => socket)
end
rescue OperationFailure, SocketError, SystemCallError, IOError => ex
close
ensure