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.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/LICENSE +1 -1
  5. data/README.md +1 -1
  6. data/lib/mongo.rb +1 -1
  7. data/lib/mongo/address.rb +23 -8
  8. data/lib/mongo/address/ipv4.rb +5 -5
  9. data/lib/mongo/address/ipv6.rb +5 -5
  10. data/lib/mongo/address/unix.rb +3 -3
  11. data/lib/mongo/auth.rb +1 -1
  12. data/lib/mongo/auth/cr.rb +1 -1
  13. data/lib/mongo/auth/ldap.rb +1 -1
  14. data/lib/mongo/auth/roles.rb +1 -1
  15. data/lib/mongo/auth/user.rb +1 -1
  16. data/lib/mongo/auth/user/view.rb +1 -1
  17. data/lib/mongo/auth/x509.rb +1 -1
  18. data/lib/mongo/bson.rb +1 -1
  19. data/lib/mongo/bulk_write.rb +1 -1
  20. data/lib/mongo/bulk_write/combineable.rb +1 -1
  21. data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
  22. data/lib/mongo/bulk_write/result.rb +1 -1
  23. data/lib/mongo/bulk_write/result_combiner.rb +1 -1
  24. data/lib/mongo/bulk_write/transformable.rb +1 -1
  25. data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
  26. data/lib/mongo/bulk_write/validatable.rb +1 -1
  27. data/lib/mongo/client.rb +1 -1
  28. data/lib/mongo/cluster.rb +2 -2
  29. data/lib/mongo/cluster/topology.rb +1 -1
  30. data/lib/mongo/cluster/topology/replica_set.rb +1 -1
  31. data/lib/mongo/cluster/topology/sharded.rb +1 -1
  32. data/lib/mongo/cluster/topology/single.rb +1 -1
  33. data/lib/mongo/cluster/topology/unknown.rb +1 -1
  34. data/lib/mongo/collection.rb +1 -1
  35. data/lib/mongo/collection/view.rb +1 -1
  36. data/lib/mongo/collection/view/aggregation.rb +1 -1
  37. data/lib/mongo/collection/view/builder.rb +1 -1
  38. data/lib/mongo/collection/view/builder/aggregation.rb +3 -2
  39. data/lib/mongo/collection/view/builder/find_command.rb +1 -1
  40. data/lib/mongo/collection/view/builder/flags.rb +1 -1
  41. data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
  42. data/lib/mongo/collection/view/builder/modifiers.rb +1 -1
  43. data/lib/mongo/collection/view/builder/op_query.rb +1 -1
  44. data/lib/mongo/collection/view/explainable.rb +1 -1
  45. data/lib/mongo/collection/view/immutable.rb +1 -1
  46. data/lib/mongo/collection/view/iterable.rb +1 -1
  47. data/lib/mongo/collection/view/map_reduce.rb +1 -1
  48. data/lib/mongo/collection/view/readable.rb +1 -1
  49. data/lib/mongo/collection/view/writable.rb +1 -1
  50. data/lib/mongo/cursor.rb +1 -1
  51. data/lib/mongo/cursor/builder.rb +1 -1
  52. data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
  53. data/lib/mongo/cursor/builder/kill_cursors_command.rb +1 -1
  54. data/lib/mongo/cursor/builder/op_get_more.rb +1 -1
  55. data/lib/mongo/cursor/builder/op_kill_cursors.rb +1 -1
  56. data/lib/mongo/database.rb +1 -1
  57. data/lib/mongo/database/view.rb +1 -1
  58. data/lib/mongo/dbref.rb +1 -1
  59. data/lib/mongo/error.rb +1 -1
  60. data/lib/mongo/error/bulk_write_error.rb +1 -1
  61. data/lib/mongo/error/closed_stream.rb +1 -1
  62. data/lib/mongo/error/extra_file_chunk.rb +1 -1
  63. data/lib/mongo/error/file_not_found.rb +1 -1
  64. data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
  65. data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
  66. data/lib/mongo/error/invalid_collection_name.rb +1 -1
  67. data/lib/mongo/error/invalid_database_name.rb +1 -1
  68. data/lib/mongo/error/invalid_document.rb +1 -1
  69. data/lib/mongo/error/invalid_file.rb +1 -1
  70. data/lib/mongo/error/invalid_file_revision.rb +1 -1
  71. data/lib/mongo/error/invalid_min_pool_size.rb +1 -1
  72. data/lib/mongo/error/invalid_nonce.rb +1 -1
  73. data/lib/mongo/error/invalid_replacement_document.rb +1 -1
  74. data/lib/mongo/error/invalid_server_preference.rb +1 -1
  75. data/lib/mongo/error/invalid_signature.rb +1 -1
  76. data/lib/mongo/error/invalid_update_document.rb +1 -1
  77. data/lib/mongo/error/invalid_uri.rb +1 -1
  78. data/lib/mongo/error/invalid_write_concern.rb +1 -1
  79. data/lib/mongo/error/max_bson_size.rb +1 -1
  80. data/lib/mongo/error/max_message_size.rb +1 -1
  81. data/lib/mongo/error/missing_file_chunk.rb +1 -1
  82. data/lib/mongo/error/multi_index_drop.rb +1 -1
  83. data/lib/mongo/error/need_primary_server.rb +1 -1
  84. data/lib/mongo/error/no_server_available.rb +1 -1
  85. data/lib/mongo/error/operation_failure.rb +1 -1
  86. data/lib/mongo/error/parser.rb +1 -1
  87. data/lib/mongo/error/socket_error.rb +1 -1
  88. data/lib/mongo/error/socket_timeout_error.rb +1 -1
  89. data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
  90. data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
  91. data/lib/mongo/error/unexpected_response.rb +1 -1
  92. data/lib/mongo/error/unsupported_collation.rb +1 -1
  93. data/lib/mongo/error/unsupported_features.rb +1 -1
  94. data/lib/mongo/event.rb +1 -1
  95. data/lib/mongo/event/description_changed.rb +1 -1
  96. data/lib/mongo/event/publisher.rb +1 -1
  97. data/lib/mongo/event/subscriber.rb +1 -1
  98. data/lib/mongo/grid.rb +1 -1
  99. data/lib/mongo/grid/file.rb +1 -1
  100. data/lib/mongo/grid/file/chunk.rb +1 -1
  101. data/lib/mongo/grid/file/info.rb +1 -1
  102. data/lib/mongo/grid/fs_bucket.rb +1 -1
  103. data/lib/mongo/grid/stream.rb +1 -1
  104. data/lib/mongo/grid/stream/read.rb +1 -1
  105. data/lib/mongo/grid/stream/write.rb +1 -1
  106. data/lib/mongo/index.rb +1 -1
  107. data/lib/mongo/index/view.rb +1 -1
  108. data/lib/mongo/loggable.rb +1 -1
  109. data/lib/mongo/logger.rb +1 -1
  110. data/lib/mongo/monitoring.rb +1 -1
  111. data/lib/mongo/operation.rb +1 -1
  112. data/lib/mongo/operation/commands.rb +1 -1
  113. data/lib/mongo/operation/commands/aggregate.rb +1 -1
  114. data/lib/mongo/operation/commands/aggregate/result.rb +1 -1
  115. data/lib/mongo/operation/commands/collections_info.rb +1 -1
  116. data/lib/mongo/operation/commands/collections_info/result.rb +1 -1
  117. data/lib/mongo/operation/commands/command.rb +1 -1
  118. data/lib/mongo/operation/commands/create.rb +1 -1
  119. data/lib/mongo/operation/commands/drop.rb +1 -1
  120. data/lib/mongo/operation/commands/drop_database.rb +1 -1
  121. data/lib/mongo/operation/commands/indexes.rb +1 -1
  122. data/lib/mongo/operation/commands/list_collections.rb +1 -1
  123. data/lib/mongo/operation/commands/list_collections/result.rb +1 -1
  124. data/lib/mongo/operation/commands/list_indexes.rb +1 -1
  125. data/lib/mongo/operation/commands/list_indexes/result.rb +1 -1
  126. data/lib/mongo/operation/commands/map_reduce.rb +1 -1
  127. data/lib/mongo/operation/commands/map_reduce/result.rb +1 -1
  128. data/lib/mongo/operation/commands/user_query.rb +1 -1
  129. data/lib/mongo/operation/commands/users_info.rb +1 -1
  130. data/lib/mongo/operation/commands/users_info/result.rb +1 -1
  131. data/lib/mongo/operation/executable.rb +1 -1
  132. data/lib/mongo/operation/kill_cursors.rb +1 -1
  133. data/lib/mongo/operation/limited.rb +1 -1
  134. data/lib/mongo/operation/read.rb +1 -1
  135. data/lib/mongo/operation/read/get_more.rb +1 -1
  136. data/lib/mongo/operation/read/query.rb +1 -1
  137. data/lib/mongo/operation/read/query/result.rb +1 -1
  138. data/lib/mongo/operation/read_preference.rb +1 -1
  139. data/lib/mongo/operation/result.rb +1 -1
  140. data/lib/mongo/operation/specifiable.rb +1 -1
  141. data/lib/mongo/operation/takes_write_concern.rb +1 -1
  142. data/lib/mongo/operation/write.rb +1 -1
  143. data/lib/mongo/operation/write/bulk.rb +1 -1
  144. data/lib/mongo/operation/write/bulk/bulkable.rb +1 -1
  145. data/lib/mongo/operation/write/bulk/delete.rb +1 -1
  146. data/lib/mongo/operation/write/bulk/delete/result.rb +1 -1
  147. data/lib/mongo/operation/write/bulk/insert.rb +1 -1
  148. data/lib/mongo/operation/write/bulk/insert/result.rb +1 -1
  149. data/lib/mongo/operation/write/bulk/legacy_mergable.rb +1 -1
  150. data/lib/mongo/operation/write/bulk/mergable.rb +1 -1
  151. data/lib/mongo/operation/write/bulk/update.rb +1 -1
  152. data/lib/mongo/operation/write/bulk/update/result.rb +1 -1
  153. data/lib/mongo/operation/write/command.rb +1 -1
  154. data/lib/mongo/operation/write/command/create_index.rb +1 -1
  155. data/lib/mongo/operation/write/command/create_user.rb +1 -1
  156. data/lib/mongo/operation/write/command/delete.rb +1 -1
  157. data/lib/mongo/operation/write/command/drop_index.rb +1 -1
  158. data/lib/mongo/operation/write/command/insert.rb +1 -1
  159. data/lib/mongo/operation/write/command/remove_user.rb +1 -1
  160. data/lib/mongo/operation/write/command/update.rb +1 -1
  161. data/lib/mongo/operation/write/command/update_user.rb +1 -1
  162. data/lib/mongo/operation/write/command/writable.rb +1 -1
  163. data/lib/mongo/operation/write/create_index.rb +1 -1
  164. data/lib/mongo/operation/write/create_user.rb +1 -1
  165. data/lib/mongo/operation/write/delete.rb +1 -1
  166. data/lib/mongo/operation/write/delete/result.rb +1 -1
  167. data/lib/mongo/operation/write/drop_index.rb +1 -1
  168. data/lib/mongo/operation/write/gle.rb +1 -1
  169. data/lib/mongo/operation/write/idable.rb +1 -1
  170. data/lib/mongo/operation/write/insert.rb +1 -1
  171. data/lib/mongo/operation/write/insert/result.rb +1 -1
  172. data/lib/mongo/operation/write/remove_user.rb +1 -1
  173. data/lib/mongo/operation/write/update.rb +1 -1
  174. data/lib/mongo/operation/write/update/result.rb +1 -1
  175. data/lib/mongo/operation/write/update_user.rb +1 -1
  176. data/lib/mongo/operation/write/write_command_enabled.rb +1 -1
  177. data/lib/mongo/protocol/bit_vector.rb +1 -1
  178. data/lib/mongo/protocol/delete.rb +1 -1
  179. data/lib/mongo/protocol/get_more.rb +1 -1
  180. data/lib/mongo/protocol/insert.rb +1 -1
  181. data/lib/mongo/protocol/kill_cursors.rb +1 -1
  182. data/lib/mongo/protocol/message.rb +1 -1
  183. data/lib/mongo/protocol/query.rb +2 -2
  184. data/lib/mongo/protocol/reply.rb +1 -1
  185. data/lib/mongo/protocol/serializers.rb +1 -1
  186. data/lib/mongo/protocol/update.rb +1 -1
  187. data/lib/mongo/server.rb +6 -1
  188. data/lib/mongo/server/connectable.rb +1 -13
  189. data/lib/mongo/server/connection.rb +17 -3
  190. data/lib/mongo/server/connection_pool.rb +1 -1
  191. data/lib/mongo/server/connection_pool/queue.rb +1 -1
  192. data/lib/mongo/server/context.rb +1 -1
  193. data/lib/mongo/server/description.rb +2 -2
  194. data/lib/mongo/server/description/features.rb +1 -1
  195. data/lib/mongo/server/description/inspector/description_changed.rb +1 -1
  196. data/lib/mongo/server/monitor.rb +1 -1
  197. data/lib/mongo/server/monitor/connection.rb +15 -9
  198. data/lib/mongo/server_selector.rb +1 -1
  199. data/lib/mongo/server_selector/nearest.rb +1 -1
  200. data/lib/mongo/server_selector/primary.rb +1 -1
  201. data/lib/mongo/server_selector/primary_preferred.rb +1 -1
  202. data/lib/mongo/server_selector/secondary.rb +1 -1
  203. data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
  204. data/lib/mongo/server_selector/selectable.rb +1 -1
  205. data/lib/mongo/socket.rb +1 -1
  206. data/lib/mongo/socket/ssl.rb +4 -4
  207. data/lib/mongo/socket/tcp.rb +4 -4
  208. data/lib/mongo/socket/unix.rb +3 -3
  209. data/lib/mongo/uri.rb +1 -1
  210. data/lib/mongo/version.rb +2 -2
  211. data/lib/mongo/write_concern/acknowledged.rb +1 -1
  212. data/lib/mongo/write_concern/normalizable.rb +1 -1
  213. data/lib/mongo/write_concern/unacknowledged.rb +1 -1
  214. data/mongo.gemspec +0 -1
  215. data/spec/mongo/address_spec.rb +8 -7
  216. data/spec/mongo/client_spec.rb +1 -1
  217. data/spec/mongo/collection/view/aggregation_spec.rb +11 -0
  218. data/spec/mongo/collection_spec.rb +11 -0
  219. data/spec/mongo/server/connection_spec.rb +108 -2
  220. data/spec/mongo/server/description_spec.rb +5 -1
  221. data/spec/mongo/server/monitor/connection_spec.rb +116 -0
  222. data/spec/mongo/socket/ssl_spec.rb +14 -12
  223. data/spec/support/authorization.rb +4 -2
  224. data/spec/support/command_monitoring.rb +1 -1
  225. data/spec/support/connection_string.rb +1 -1
  226. data/spec/support/connection_string_tests/invalid-uris.yml +32 -0
  227. data/spec/support/connection_string_tests/valid-auth.yml +4 -19
  228. data/spec/support/connection_string_tests/valid-db-with-dotted-name.yml +77 -0
  229. data/spec/support/connection_string_tests/valid-options.yml +0 -13
  230. data/spec/support/connection_string_tests/valid-unix_socket-absolute.yml +6 -6
  231. data/spec/support/connection_string_tests/valid-unix_socket-relative.yml +4 -4
  232. data/spec/support/crud.rb +1 -1
  233. data/spec/support/crud/read.rb +3 -3
  234. data/spec/support/crud/write.rb +8 -3
  235. data/spec/support/gridfs.rb +1 -1
  236. metadata +6 -2
  237. metadata.gz.sig +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,5 +1,5 @@
1
1
 
2
- # Copyright (C) 2014-2016 MongoDB, Inc.
2
+ # Copyright (C) 2014-2017 MongoDB, Inc.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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 consistancy and integrity the results.
28
+ # parameters or the desired consistency and integrity the results.
29
29
  #
30
30
  # @api semipublic
31
31
  class Query < Message
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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-2016 MongoDB, Inc.
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-2016 MongoDB, Inc.
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(timeout, ssl_options)
63
- socket.connect!
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)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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..4).freeze
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
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB Inc.
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.
@@ -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(timeout, ssl_options)
77
- socket.connect!
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 connection timeout.
127
+ # Get the socket timeout.
126
128
  #
127
- # @example Get the connection timeout.
128
- # connection.timeout
129
+ # @example Get the socket timeout.
130
+ # connection.socket_timeout
129
131
  #
130
- # @return [ Float ] The connection timeout in seconds.
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.0.0
133
- def timeout
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
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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 connection timeout.
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(timeout, Error::SocketTimeoutError) do
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?
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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 connection timeout.
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(timeout, Error::SocketTimeoutError) do
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)) }
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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 connection timeout.
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
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.2'.freeze
20
+ VERSION = '2.4.3'.freeze
21
21
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 MongoDB, Inc.
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.