Skip to content

Commit fe0c6ec

Browse files
committed
cleaning up some long-standing TODO comments
1 parent e338355 commit fe0c6ec

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

lib/mongo/cluster/reapers/cursor_reaper.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,10 @@ def kill_cursors
177177
end
178178

179179
unless server
180-
# TODO: We currently don't have a server for the address that the
181-
# cursor is associated with. We should leave the cursor in the
182-
# queue to be killed at a later time (when the server comes back).
180+
# The server for this cursor has gone away --- maybe temporarily,
181+
# maybe permanently, but we can't know. To prevent connections from
182+
# leaking in the case of a permanent failure, we'll just silently
183+
# drop this killspec and move on.
183184
next
184185
end
185186

lib/mongo/operation/result.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ class Result
104104
def initialize(replies, connection_description = nil, connection_global_id = nil, context: nil, connection: nil)
105105
@context = context
106106

107-
# TODO: older versions of MongoDB (2.4 and below?) could sometimes end
108-
# up with nil here, which indicated an unackowledged write. Is that
109-
# still the case? Can we simplify this?
110107
return unless replies
111108

112109
if replies.is_a?(Array)

lib/mongo/protocol/msg.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ def documents
208208
# @return [ Mongo::Protocol::Msg ] The encrypted message, or the original
209209
# message if encryption was not possible or necessary.
210210
def maybe_encrypt(connection, context)
211-
# TODO: verify compression happens later, i.e. when this method runs
212-
# the message is not compressed.
213211
if context.encrypt?
214212
if connection.description.max_wire_version < 8
215213
raise Error::CryptError.new(

lib/mongo/socket/ocsp_cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Socket
1919
# This module caches OCSP responses for their indicated validity time.
2020
#
2121
# The key is the CertificateId used for the OCSP request.
22-
# The value is the SingleResponse.
22+
# The value is an OcspVerifier::Response.
2323
#
2424
# @api private
2525
module OcspCache

lib/mongo/socket/ocsp_verifier.rb

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
require 'delegate'
18+
1719
module Net
1820
autoload :HTTP, 'net/http'
1921
end
@@ -31,6 +33,19 @@ class Socket
3133
#
3234
# @api private
3335
class OcspVerifier
36+
# Wraps OpenSSL::OCSP::SingleResponse with the responder URI that supplied it.
37+
#
38+
# @api private
39+
class Response < SimpleDelegator
40+
attr_reader :uri, :original_uri
41+
42+
def initialize(single_response, uri, original_uri)
43+
super(single_response)
44+
@uri = uri
45+
@original_uri = original_uri
46+
end
47+
end
48+
3449
include Loggable
3550

3651
# @param [ String ] host_name The host name being verified, for
@@ -228,18 +243,13 @@ def verify_one_responder(uri)
228243
return false
229244
end
230245

231-
resp = resp.find_response(cert_id)
232-
unless resp
246+
single_response = resp.find_response(cert_id)
247+
unless single_response
233248
@resp_errors << "OCSP response from #{report_uri(original_uri,
234249
uri)} did not include information about the requested certificate"
235250
return false
236251
end
237-
# TODO: make a new class instead of patching the stdlib one?
238-
resp.instance_variable_set(:@uri, uri)
239-
resp.instance_variable_set(:@original_uri, original_uri)
240-
class << resp
241-
attr_reader :uri, :original_uri
242-
end
252+
resp = Response.new(single_response, uri, original_uri)
243253

244254
unless resp.check_validity
245255
@resp_errors << "OCSP response from #{report_uri(original_uri,

0 commit comments

Comments
 (0)