mongo 2.4.2 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/mongo.rb +1 -1
- data/lib/mongo/address.rb +23 -8
- data/lib/mongo/address/ipv4.rb +5 -5
- data/lib/mongo/address/ipv6.rb +5 -5
- data/lib/mongo/address/unix.rb +3 -3
- data/lib/mongo/auth.rb +1 -1
- data/lib/mongo/auth/cr.rb +1 -1
- data/lib/mongo/auth/ldap.rb +1 -1
- data/lib/mongo/auth/roles.rb +1 -1
- data/lib/mongo/auth/user.rb +1 -1
- data/lib/mongo/auth/user/view.rb +1 -1
- data/lib/mongo/auth/x509.rb +1 -1
- data/lib/mongo/bson.rb +1 -1
- data/lib/mongo/bulk_write.rb +1 -1
- data/lib/mongo/bulk_write/combineable.rb +1 -1
- data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/result.rb +1 -1
- data/lib/mongo/bulk_write/result_combiner.rb +1 -1
- data/lib/mongo/bulk_write/transformable.rb +1 -1
- data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/validatable.rb +1 -1
- data/lib/mongo/client.rb +1 -1
- data/lib/mongo/cluster.rb +2 -2
- data/lib/mongo/cluster/topology.rb +1 -1
- data/lib/mongo/cluster/topology/replica_set.rb +1 -1
- data/lib/mongo/cluster/topology/sharded.rb +1 -1
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/cluster/topology/unknown.rb +1 -1
- data/lib/mongo/collection.rb +1 -1
- data/lib/mongo/collection/view.rb +1 -1
- data/lib/mongo/collection/view/aggregation.rb +1 -1
- data/lib/mongo/collection/view/builder.rb +1 -1
- data/lib/mongo/collection/view/builder/aggregation.rb +3 -2
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/builder/flags.rb +1 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +1 -1
- data/lib/mongo/collection/view/builder/op_query.rb +1 -1
- data/lib/mongo/collection/view/explainable.rb +1 -1
- data/lib/mongo/collection/view/immutable.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +1 -1
- data/lib/mongo/collection/view/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/readable.rb +1 -1
- data/lib/mongo/collection/view/writable.rb +1 -1
- data/lib/mongo/cursor.rb +1 -1
- data/lib/mongo/cursor/builder.rb +1 -1
- data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +1 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +1 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +1 -1
- data/lib/mongo/database.rb +1 -1
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/dbref.rb +1 -1
- data/lib/mongo/error.rb +1 -1
- data/lib/mongo/error/bulk_write_error.rb +1 -1
- data/lib/mongo/error/closed_stream.rb +1 -1
- data/lib/mongo/error/extra_file_chunk.rb +1 -1
- data/lib/mongo/error/file_not_found.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
- data/lib/mongo/error/invalid_collection_name.rb +1 -1
- data/lib/mongo/error/invalid_database_name.rb +1 -1
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_file.rb +1 -1
- data/lib/mongo/error/invalid_file_revision.rb +1 -1
- data/lib/mongo/error/invalid_min_pool_size.rb +1 -1
- data/lib/mongo/error/invalid_nonce.rb +1 -1
- data/lib/mongo/error/invalid_replacement_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +1 -1
- data/lib/mongo/error/invalid_signature.rb +1 -1
- data/lib/mongo/error/invalid_update_document.rb +1 -1
- data/lib/mongo/error/invalid_uri.rb +1 -1
- data/lib/mongo/error/invalid_write_concern.rb +1 -1
- data/lib/mongo/error/max_bson_size.rb +1 -1
- data/lib/mongo/error/max_message_size.rb +1 -1
- data/lib/mongo/error/missing_file_chunk.rb +1 -1
- data/lib/mongo/error/multi_index_drop.rb +1 -1
- data/lib/mongo/error/need_primary_server.rb +1 -1
- data/lib/mongo/error/no_server_available.rb +1 -1
- data/lib/mongo/error/operation_failure.rb +1 -1
- data/lib/mongo/error/parser.rb +1 -1
- data/lib/mongo/error/socket_error.rb +1 -1
- data/lib/mongo/error/socket_timeout_error.rb +1 -1
- data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
- data/lib/mongo/error/unexpected_response.rb +1 -1
- data/lib/mongo/error/unsupported_collation.rb +1 -1
- data/lib/mongo/error/unsupported_features.rb +1 -1
- data/lib/mongo/event.rb +1 -1
- data/lib/mongo/event/description_changed.rb +1 -1
- data/lib/mongo/event/publisher.rb +1 -1
- data/lib/mongo/event/subscriber.rb +1 -1
- data/lib/mongo/grid.rb +1 -1
- data/lib/mongo/grid/file.rb +1 -1
- data/lib/mongo/grid/file/chunk.rb +1 -1
- data/lib/mongo/grid/file/info.rb +1 -1
- data/lib/mongo/grid/fs_bucket.rb +1 -1
- data/lib/mongo/grid/stream.rb +1 -1
- data/lib/mongo/grid/stream/read.rb +1 -1
- data/lib/mongo/grid/stream/write.rb +1 -1
- data/lib/mongo/index.rb +1 -1
- data/lib/mongo/index/view.rb +1 -1
- data/lib/mongo/loggable.rb +1 -1
- data/lib/mongo/logger.rb +1 -1
- data/lib/mongo/monitoring.rb +1 -1
- data/lib/mongo/operation.rb +1 -1
- data/lib/mongo/operation/commands.rb +1 -1
- data/lib/mongo/operation/commands/aggregate.rb +1 -1
- data/lib/mongo/operation/commands/aggregate/result.rb +1 -1
- data/lib/mongo/operation/commands/collections_info.rb +1 -1
- data/lib/mongo/operation/commands/collections_info/result.rb +1 -1
- data/lib/mongo/operation/commands/command.rb +1 -1
- data/lib/mongo/operation/commands/create.rb +1 -1
- data/lib/mongo/operation/commands/drop.rb +1 -1
- data/lib/mongo/operation/commands/drop_database.rb +1 -1
- data/lib/mongo/operation/commands/indexes.rb +1 -1
- data/lib/mongo/operation/commands/list_collections.rb +1 -1
- data/lib/mongo/operation/commands/list_collections/result.rb +1 -1
- data/lib/mongo/operation/commands/list_indexes.rb +1 -1
- data/lib/mongo/operation/commands/list_indexes/result.rb +1 -1
- data/lib/mongo/operation/commands/map_reduce.rb +1 -1
- data/lib/mongo/operation/commands/map_reduce/result.rb +1 -1
- data/lib/mongo/operation/commands/user_query.rb +1 -1
- data/lib/mongo/operation/commands/users_info.rb +1 -1
- data/lib/mongo/operation/commands/users_info/result.rb +1 -1
- data/lib/mongo/operation/executable.rb +1 -1
- data/lib/mongo/operation/kill_cursors.rb +1 -1
- data/lib/mongo/operation/limited.rb +1 -1
- data/lib/mongo/operation/read.rb +1 -1
- data/lib/mongo/operation/read/get_more.rb +1 -1
- data/lib/mongo/operation/read/query.rb +1 -1
- data/lib/mongo/operation/read/query/result.rb +1 -1
- data/lib/mongo/operation/read_preference.rb +1 -1
- data/lib/mongo/operation/result.rb +1 -1
- data/lib/mongo/operation/specifiable.rb +1 -1
- data/lib/mongo/operation/takes_write_concern.rb +1 -1
- data/lib/mongo/operation/write.rb +1 -1
- data/lib/mongo/operation/write/bulk.rb +1 -1
- data/lib/mongo/operation/write/bulk/bulkable.rb +1 -1
- data/lib/mongo/operation/write/bulk/delete.rb +1 -1
- data/lib/mongo/operation/write/bulk/delete/result.rb +1 -1
- data/lib/mongo/operation/write/bulk/insert.rb +1 -1
- data/lib/mongo/operation/write/bulk/insert/result.rb +1 -1
- data/lib/mongo/operation/write/bulk/legacy_mergable.rb +1 -1
- data/lib/mongo/operation/write/bulk/mergable.rb +1 -1
- data/lib/mongo/operation/write/bulk/update.rb +1 -1
- data/lib/mongo/operation/write/bulk/update/result.rb +1 -1
- data/lib/mongo/operation/write/command.rb +1 -1
- data/lib/mongo/operation/write/command/create_index.rb +1 -1
- data/lib/mongo/operation/write/command/create_user.rb +1 -1
- data/lib/mongo/operation/write/command/delete.rb +1 -1
- data/lib/mongo/operation/write/command/drop_index.rb +1 -1
- data/lib/mongo/operation/write/command/insert.rb +1 -1
- data/lib/mongo/operation/write/command/remove_user.rb +1 -1
- data/lib/mongo/operation/write/command/update.rb +1 -1
- data/lib/mongo/operation/write/command/update_user.rb +1 -1
- data/lib/mongo/operation/write/command/writable.rb +1 -1
- data/lib/mongo/operation/write/create_index.rb +1 -1
- data/lib/mongo/operation/write/create_user.rb +1 -1
- data/lib/mongo/operation/write/delete.rb +1 -1
- data/lib/mongo/operation/write/delete/result.rb +1 -1
- data/lib/mongo/operation/write/drop_index.rb +1 -1
- data/lib/mongo/operation/write/gle.rb +1 -1
- data/lib/mongo/operation/write/idable.rb +1 -1
- data/lib/mongo/operation/write/insert.rb +1 -1
- data/lib/mongo/operation/write/insert/result.rb +1 -1
- data/lib/mongo/operation/write/remove_user.rb +1 -1
- data/lib/mongo/operation/write/update.rb +1 -1
- data/lib/mongo/operation/write/update/result.rb +1 -1
- data/lib/mongo/operation/write/update_user.rb +1 -1
- data/lib/mongo/operation/write/write_command_enabled.rb +1 -1
- data/lib/mongo/protocol/bit_vector.rb +1 -1
- data/lib/mongo/protocol/delete.rb +1 -1
- data/lib/mongo/protocol/get_more.rb +1 -1
- data/lib/mongo/protocol/insert.rb +1 -1
- data/lib/mongo/protocol/kill_cursors.rb +1 -1
- data/lib/mongo/protocol/message.rb +1 -1
- data/lib/mongo/protocol/query.rb +2 -2
- data/lib/mongo/protocol/reply.rb +1 -1
- data/lib/mongo/protocol/serializers.rb +1 -1
- data/lib/mongo/protocol/update.rb +1 -1
- data/lib/mongo/server.rb +6 -1
- data/lib/mongo/server/connectable.rb +1 -13
- data/lib/mongo/server/connection.rb +17 -3
- data/lib/mongo/server/connection_pool.rb +1 -1
- data/lib/mongo/server/connection_pool/queue.rb +1 -1
- data/lib/mongo/server/context.rb +1 -1
- data/lib/mongo/server/description.rb +2 -2
- data/lib/mongo/server/description/features.rb +1 -1
- data/lib/mongo/server/description/inspector/description_changed.rb +1 -1
- data/lib/mongo/server/monitor.rb +1 -1
- data/lib/mongo/server/monitor/connection.rb +15 -9
- data/lib/mongo/server_selector.rb +1 -1
- data/lib/mongo/server_selector/nearest.rb +1 -1
- data/lib/mongo/server_selector/primary.rb +1 -1
- data/lib/mongo/server_selector/primary_preferred.rb +1 -1
- data/lib/mongo/server_selector/secondary.rb +1 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
- data/lib/mongo/server_selector/selectable.rb +1 -1
- data/lib/mongo/socket.rb +1 -1
- data/lib/mongo/socket/ssl.rb +4 -4
- data/lib/mongo/socket/tcp.rb +4 -4
- data/lib/mongo/socket/unix.rb +3 -3
- data/lib/mongo/uri.rb +1 -1
- data/lib/mongo/version.rb +2 -2
- data/lib/mongo/write_concern/acknowledged.rb +1 -1
- data/lib/mongo/write_concern/normalizable.rb +1 -1
- data/lib/mongo/write_concern/unacknowledged.rb +1 -1
- data/mongo.gemspec +0 -1
- data/spec/mongo/address_spec.rb +8 -7
- data/spec/mongo/client_spec.rb +1 -1
- data/spec/mongo/collection/view/aggregation_spec.rb +11 -0
- data/spec/mongo/collection_spec.rb +11 -0
- data/spec/mongo/server/connection_spec.rb +108 -2
- data/spec/mongo/server/description_spec.rb +5 -1
- data/spec/mongo/server/monitor/connection_spec.rb +116 -0
- data/spec/mongo/socket/ssl_spec.rb +14 -12
- data/spec/support/authorization.rb +4 -2
- data/spec/support/command_monitoring.rb +1 -1
- data/spec/support/connection_string.rb +1 -1
- data/spec/support/connection_string_tests/invalid-uris.yml +32 -0
- data/spec/support/connection_string_tests/valid-auth.yml +4 -19
- data/spec/support/connection_string_tests/valid-db-with-dotted-name.yml +77 -0
- data/spec/support/connection_string_tests/valid-options.yml +0 -13
- data/spec/support/connection_string_tests/valid-unix_socket-absolute.yml +6 -6
- data/spec/support/connection_string_tests/valid-unix_socket-relative.yml +4 -4
- data/spec/support/crud.rb +1 -1
- data/spec/support/crud/read.rb +3 -3
- data/spec/support/crud/write.rb +8 -3
- data/spec/support/gridfs.rb +1 -1
- metadata +6 -2
- metadata.gz.sig +0 -0
data/lib/mongo/protocol/query.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -25,7 +25,7 @@ module Mongo
|
|
25
25
|
# number of returned documents.
|
26
26
|
#
|
27
27
|
# There are a variety of flags that can be used to adjust cursor
|
28
|
-
# parameters or the desired
|
28
|
+
# parameters or the desired consistency and integrity the results.
|
29
29
|
#
|
30
30
|
# @api semipublic
|
31
31
|
class Query < Message
|
data/lib/mongo/protocol/reply.rb
CHANGED
data/lib/mongo/server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -44,6 +44,11 @@ module Mongo
|
|
44
44
|
# @return [ Monitoring ] monitoring The monitoring.
|
45
45
|
attr_reader :monitoring
|
46
46
|
|
47
|
+
# The default time in seconds to timeout a connection attempt.
|
48
|
+
#
|
49
|
+
# @since 2.4.3
|
50
|
+
CONNECT_TIMEOUT = 10.freeze
|
51
|
+
|
47
52
|
# Get the description from the monitor and scan on monitor.
|
48
53
|
def_delegators :monitor, :description, :scan!, :heartbeat_frequency, :last_scan
|
49
54
|
alias :heartbeat_frequency_seconds :heartbeat_frequency
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2017 MongoDB, Inc.
|
2
2
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -68,18 +68,6 @@ module Mongo
|
|
68
68
|
!!@socket && @socket.alive?
|
69
69
|
end
|
70
70
|
|
71
|
-
# Get the timeout to execute an operation on a socket.
|
72
|
-
#
|
73
|
-
# @example Get the timeout to execute an operation on a socket.
|
74
|
-
# connection.timeout
|
75
|
-
#
|
76
|
-
# @return [ Float ] The operation timeout in seconds.
|
77
|
-
#
|
78
|
-
# @since 2.0.0
|
79
|
-
def timeout
|
80
|
-
@timeout ||= options[:socket_timeout]
|
81
|
-
end
|
82
|
-
|
83
71
|
protected
|
84
72
|
|
85
73
|
attr_reader :socket
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -59,8 +59,8 @@ module Mongo
|
|
59
59
|
# @since 2.0.0
|
60
60
|
def connect!
|
61
61
|
unless socket && socket.connectable?
|
62
|
-
@socket = address.socket(
|
63
|
-
|
62
|
+
@socket = address.socket(socket_timeout, ssl_options)
|
63
|
+
address.connect_socket!(socket)
|
64
64
|
handshake!
|
65
65
|
authenticate!
|
66
66
|
end
|
@@ -156,6 +156,20 @@ module Mongo
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
+
# Get the timeout to execute an operation on a socket.
|
160
|
+
#
|
161
|
+
# @example Get the timeout to execute an operation on a socket.
|
162
|
+
# connection.timeout
|
163
|
+
#
|
164
|
+
# @return [ Float ] The operation timeout in seconds.
|
165
|
+
#
|
166
|
+
# @since 2.0.0
|
167
|
+
def socket_timeout
|
168
|
+
@timeout ||= options[:socket_timeout]
|
169
|
+
end
|
170
|
+
# @deprecated Please use :socket_timeout instead. Will be removed in 3.0.0
|
171
|
+
alias :timeout :socket_timeout
|
172
|
+
|
159
173
|
private
|
160
174
|
|
161
175
|
def deliver(messages)
|
data/lib/mongo/server/context.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -157,7 +157,7 @@ module Mongo
|
|
157
157
|
# Fields to exclude when comparing two descriptions.
|
158
158
|
#
|
159
159
|
# @since 2.0.6
|
160
|
-
EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME ].freeze
|
160
|
+
EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME, LAST_WRITE ].freeze
|
161
161
|
|
162
162
|
# @return [ Address ] address The server's address.
|
163
163
|
attr_reader :address
|
@@ -38,7 +38,7 @@ module Mongo
|
|
38
38
|
# The wire protocol versions that this version of the driver supports.
|
39
39
|
#
|
40
40
|
# @since 2.0.0
|
41
|
-
DRIVER_WIRE_VERSIONS = (0..
|
41
|
+
DRIVER_WIRE_VERSIONS = (0..5).freeze
|
42
42
|
|
43
43
|
# Create the methods for each mapping to tell if they are supported.
|
44
44
|
#
|
data/lib/mongo/server/monitor.rb
CHANGED
@@ -41,6 +41,8 @@ module Mongo
|
|
41
41
|
# The default time in seconds to timeout a connection attempt.
|
42
42
|
#
|
43
43
|
# @since 2.1.2
|
44
|
+
#
|
45
|
+
# @deprecated Please use Server::CONNECT_TIMEOUT instead. Will be removed in 3.0.0
|
44
46
|
CONNECT_TIMEOUT = 10.freeze
|
45
47
|
|
46
48
|
# Send the preserialized ismaster call.
|
@@ -73,8 +75,8 @@ module Mongo
|
|
73
75
|
# @since 2.0.0
|
74
76
|
def connect!
|
75
77
|
unless socket && socket.connectable?
|
76
|
-
@socket = address.socket(
|
77
|
-
|
78
|
+
@socket = address.socket(socket_timeout, ssl_options)
|
79
|
+
address.connect_socket!(socket)
|
78
80
|
handshake!
|
79
81
|
end
|
80
82
|
true
|
@@ -122,17 +124,21 @@ module Mongo
|
|
122
124
|
@pid = Process.pid
|
123
125
|
end
|
124
126
|
|
125
|
-
# Get the
|
127
|
+
# Get the socket timeout.
|
126
128
|
#
|
127
|
-
# @example Get the
|
128
|
-
# connection.
|
129
|
+
# @example Get the socket timeout.
|
130
|
+
# connection.socket_timeout
|
129
131
|
#
|
130
|
-
# @return [ Float ] The
|
132
|
+
# @return [ Float ] The socket timeout in seconds. Note that the Monitor's connection
|
133
|
+
# uses the connect timeout value for calling ismaster. See the Server Discovery and
|
134
|
+
# Monitoring specification for details.
|
131
135
|
#
|
132
|
-
# @since 2.
|
133
|
-
def
|
134
|
-
@timeout ||= options[:connect_timeout] || CONNECT_TIMEOUT
|
136
|
+
# @since 2.4.3
|
137
|
+
def socket_timeout
|
138
|
+
@timeout ||= options[:connect_timeout] || Server::CONNECT_TIMEOUT
|
135
139
|
end
|
140
|
+
# @deprecated Please use :socket_timeout instead. Will be removed in 3.0.0
|
141
|
+
alias :timeout :socket_timeout
|
136
142
|
|
137
143
|
private
|
138
144
|
|
data/lib/mongo/socket.rb
CHANGED
data/lib/mongo/socket/ssl.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -38,7 +38,7 @@ module Mongo
|
|
38
38
|
# @return [ Integer ] port The port to connect to.
|
39
39
|
attr_reader :port
|
40
40
|
|
41
|
-
# @return [ Float ] timeout The
|
41
|
+
# @return [ Float ] timeout The socket timeout.
|
42
42
|
attr_reader :timeout
|
43
43
|
|
44
44
|
# Establishes a socket connection.
|
@@ -52,8 +52,8 @@ module Mongo
|
|
52
52
|
# @return [ SSL ] The connected socket instance.
|
53
53
|
#
|
54
54
|
# @since 2.0.0
|
55
|
-
def connect!
|
56
|
-
Timeout.timeout(
|
55
|
+
def connect!(connect_timeout = nil)
|
56
|
+
Timeout.timeout(connect_timeout, Error::SocketTimeoutError) do
|
57
57
|
handle_errors { @tcp_socket.connect(::Socket.pack_sockaddr_in(port, host)) }
|
58
58
|
@socket = OpenSSL::SSL::SSLSocket.new(@tcp_socket, context)
|
59
59
|
@socket.hostname = @host_name unless BSON::Environment.jruby?
|
data/lib/mongo/socket/tcp.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -26,7 +26,7 @@ module Mongo
|
|
26
26
|
# @return [ Integer ] port The port to connect to.
|
27
27
|
attr_reader :port
|
28
28
|
|
29
|
-
# @return [ Float ] timeout The
|
29
|
+
# @return [ Float ] timeout The socket timeout.
|
30
30
|
attr_reader :timeout
|
31
31
|
|
32
32
|
# Establishes a socket connection.
|
@@ -40,8 +40,8 @@ module Mongo
|
|
40
40
|
# @return [ TCP ] The connected socket instance.
|
41
41
|
#
|
42
42
|
# @since 2.0.0
|
43
|
-
def connect!
|
44
|
-
Timeout.timeout(
|
43
|
+
def connect!(connect_timeout = nil)
|
44
|
+
Timeout.timeout(connect_timeout, Error::SocketTimeoutError) do
|
45
45
|
socket.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1)
|
46
46
|
socket.setsockopt(SOL_SOCKET, SO_KEEPALIVE, true)
|
47
47
|
handle_errors { socket.connect(::Socket.pack_sockaddr_in(port, host)) }
|
data/lib/mongo/socket/unix.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -23,7 +23,7 @@ module Mongo
|
|
23
23
|
# @return [ String ] path The path to connect to.
|
24
24
|
attr_reader :path
|
25
25
|
|
26
|
-
# @return [ Float ] timeout The
|
26
|
+
# @return [ Float ] timeout The socket timeout.
|
27
27
|
attr_reader :timeout
|
28
28
|
|
29
29
|
# Establishes a socket connection.
|
@@ -37,7 +37,7 @@ module Mongo
|
|
37
37
|
# @return [ Unix ] The connected socket instance.
|
38
38
|
#
|
39
39
|
# @since 2.0.0
|
40
|
-
def connect!
|
40
|
+
def connect!(connect_timeout = nil)
|
41
41
|
self
|
42
42
|
end
|
43
43
|
|
data/lib/mongo/uri.rb
CHANGED
data/lib/mongo/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -17,5 +17,5 @@ module Mongo
|
|
17
17
|
# The current version of the driver.
|
18
18
|
#
|
19
19
|
# @since 2.0.0
|
20
|
-
VERSION = '2.4.
|
20
|
+
VERSION = '2.4.3'.freeze
|
21
21
|
end
|