File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -170,16 +170,13 @@ def authenticate!
170
170
end
171
171
172
172
def default_mechanism
173
- ensure_connected do |socket |
174
- read_with_one_retry do
175
- socket . write ( Monitor ::Connection ::ISMASTER_BYTES )
176
- ismaster = Protocol ::Reply . deserialize ( socket , max_message_size ) . documents [ 0 ]
177
- min_wire_version = ismaster [ Description ::MIN_WIRE_VERSION ] || Description ::LEGACY_WIRE_VERSION
178
- max_wire_version = ismaster [ Description ::MAX_WIRE_VERSION ] || Description ::LEGACY_WIRE_VERSION
179
- features = Description ::Features . new ( min_wire_version ..max_wire_version )
180
- ( features . scram_sha_1_enabled? || @server . features . scram_sha_1_enabled? ) ? :scram : :mongodb_cr
181
- end
182
- end
173
+ return ( @server . features . scram_sha_1_enabled? ? :scram : :mongodb_cr ) unless socket
174
+ socket . write ( Monitor ::Connection ::ISMASTER_BYTES )
175
+ ismaster = Protocol ::Reply . deserialize ( socket , max_message_size ) . documents [ 0 ]
176
+ min_wire_version = ismaster [ Description ::MIN_WIRE_VERSION ] || Description ::LEGACY_WIRE_VERSION
177
+ max_wire_version = ismaster [ Description ::MAX_WIRE_VERSION ] || Description ::LEGACY_WIRE_VERSION
178
+ features = Description ::Features . new ( min_wire_version ..max_wire_version )
179
+ ( features . scram_sha_1_enabled? || @server . features . scram_sha_1_enabled? ) ? :scram : :mongodb_cr
183
180
end
184
181
185
182
def write ( messages , buffer = BSON ::ByteBuffer . new )
Original file line number Diff line number Diff line change 118
118
end
119
119
120
120
let! ( :error ) do
121
- e = begin ; connection . connect! ; rescue => ex ; ex ; end
121
+ e = begin ; connection . send ( :ensure_connected ) ; rescue => ex ; ex ; end
122
122
end
123
123
124
124
it 'raises an error' do
You can’t perform that action at this time.
0 commit comments