zeroc-ice 3.8.1 → 3.8.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 (280) hide show
  1. checksums.yaml +4 -4
  2. data/dist/IceRuby/Communicator.cpp +26 -9
  3. data/dist/IceRuby/Config.h +0 -12
  4. data/dist/IceRuby/Connection.cpp +18 -9
  5. data/dist/IceRuby/DefaultSliceLoader.h +1 -1
  6. data/dist/IceRuby/Endpoint.cpp +21 -8
  7. data/dist/IceRuby/Operation.cpp +29 -11
  8. data/dist/IceRuby/Properties.cpp +3 -4
  9. data/dist/IceRuby/Proxy.cpp +11 -19
  10. data/dist/IceRuby/RubySliceLoader.cpp +1 -1
  11. data/dist/IceRuby/RubySliceLoader.h +6 -0
  12. data/dist/IceRuby/Types.cpp +162 -138
  13. data/dist/IceRuby/Types.h +68 -28
  14. data/dist/IceRuby/Util.cpp +14 -78
  15. data/dist/IceRuby/Util.h +7 -17
  16. data/dist/ice/cpp/include/Ice/Communicator.h +31 -8
  17. data/dist/ice/cpp/include/Ice/Config.h +2 -2
  18. data/dist/ice/cpp/include/Ice/Connection.h +24 -8
  19. data/dist/ice/cpp/include/Ice/CtrlCHandler.h +1 -1
  20. data/dist/ice/cpp/include/Ice/Demangle.h +1 -1
  21. data/dist/ice/cpp/include/Ice/Endpoint.h +4 -4
  22. data/dist/ice/cpp/include/Ice/Initialize.h +4 -4
  23. data/dist/ice/cpp/include/Ice/InputStream.h +5 -5
  24. data/dist/ice/cpp/include/Ice/Instrumentation.h +13 -7
  25. data/dist/ice/cpp/include/Ice/LocalExceptions.h +26 -5
  26. data/dist/ice/cpp/include/Ice/Logger.h +7 -0
  27. data/dist/ice/cpp/include/Ice/LoggerUtil.h +1 -1
  28. data/dist/ice/cpp/include/Ice/Object.h +10 -8
  29. data/dist/ice/cpp/include/Ice/ObjectAdapter.h +1 -1
  30. data/dist/ice/cpp/include/Ice/OutgoingAsync.h +5 -2
  31. data/dist/ice/cpp/include/Ice/OutgoingResponse.h +2 -1
  32. data/dist/ice/cpp/include/Ice/OutputStream.h +14 -11
  33. data/dist/ice/cpp/include/Ice/PluginFactory.h +1 -1
  34. data/dist/ice/cpp/include/Ice/Properties.h +3 -3
  35. data/dist/ice/cpp/include/Ice/Proxy.h +192 -50
  36. data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +3 -3
  37. data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +1 -1
  38. data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +5 -5
  39. data/dist/ice/cpp/include/Ice/ServantLocator.h +1 -1
  40. data/dist/ice/cpp/include/Ice/Service.h +2 -5
  41. data/dist/ice/cpp/include/Ice/SliceLoader.h +1 -1
  42. data/dist/ice/cpp/include/Ice/SlicedData.h +5 -3
  43. data/dist/ice/cpp/include/Ice/StreamHelpers.h +1 -1
  44. data/dist/ice/cpp/include/Ice/StreamableTraits.h +2 -2
  45. data/dist/ice/cpp/include/Ice/StringConverter.h +2 -3
  46. data/dist/ice/cpp/include/Ice/StringUtil.h +2 -7
  47. data/dist/ice/cpp/include/Ice/UUID.h +1 -0
  48. data/dist/ice/cpp/include/Ice/Value.h +2 -2
  49. data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
  50. data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
  51. data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
  52. data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
  53. data/dist/ice/cpp/include/generated/Ice/Locator.h +57 -23
  54. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
  55. data/dist/ice/cpp/include/generated/Ice/Metrics.h +99 -44
  56. data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
  57. data/dist/ice/cpp/include/generated/Ice/Process.h +34 -8
  58. data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +42 -11
  59. data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
  60. data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +93 -40
  61. data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +8 -4
  62. data/dist/ice/cpp/include/generated/Ice/Router.h +55 -19
  63. data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
  64. data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
  65. data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +66 -14
  66. data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +34 -8
  67. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +1 -1
  68. data/dist/ice/cpp/src/Ice/Base64.cpp +47 -137
  69. data/dist/ice/cpp/src/Ice/Base64.h +2 -2
  70. data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +28 -13
  71. data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +5 -1
  72. data/dist/ice/cpp/src/Ice/Buffer.cpp +1 -1
  73. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +6 -4
  74. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +1 -1
  75. data/dist/ice/cpp/src/Ice/Communicator.cpp +4 -3
  76. data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +8 -0
  77. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +5 -15
  78. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +1 -1
  79. data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +6 -8
  80. data/dist/ice/cpp/src/Ice/ConnectionFactory.h +0 -3
  81. data/dist/ice/cpp/src/Ice/ConnectionI.cpp +121 -108
  82. data/dist/ice/cpp/src/Ice/ConnectionI.h +12 -9
  83. data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +1 -1
  84. data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -14
  85. data/dist/ice/cpp/src/Ice/EndpointI.h +1 -1
  86. data/dist/ice/cpp/src/Ice/FileUtil.cpp +15 -79
  87. data/dist/ice/cpp/src/Ice/FileUtil.h +0 -3
  88. data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
  89. data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
  90. data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
  91. data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +4 -0
  92. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
  93. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +2 -4
  94. data/dist/ice/cpp/src/Ice/InputStream.cpp +50 -33
  95. data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
  96. data/dist/ice/cpp/src/Ice/Instance.h +1 -6
  97. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +7 -1
  98. data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
  99. data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
  100. data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
  101. data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
  102. data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
  103. data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
  104. data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
  105. data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
  106. data/dist/ice/cpp/src/Ice/Network.h +12 -7
  107. data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
  108. data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
  109. data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
  110. data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
  111. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
  112. data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
  113. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +2 -2
  114. data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +127 -127
  115. data/dist/ice/cpp/src/Ice/OutgoingResponseInternal.h +21 -0
  116. data/dist/ice/cpp/src/Ice/OutputStream.cpp +50 -65
  117. data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
  118. data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
  119. data/dist/ice/cpp/src/Ice/PropertyNames.cpp +2 -1
  120. data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
  121. data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
  122. data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
  123. data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
  124. data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
  125. data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +4 -4
  126. data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
  127. data/dist/ice/cpp/src/Ice/Random.h +6 -2
  128. data/dist/ice/cpp/src/Ice/Reference.cpp +37 -26
  129. data/dist/ice/cpp/src/Ice/Reference.h +3 -0
  130. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +26 -13
  131. data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
  132. data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
  133. data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
  134. data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
  135. data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
  136. data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
  137. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
  138. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
  139. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +27 -12
  140. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +1 -2
  141. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
  142. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
  143. data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
  144. data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +1 -1
  145. data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +1 -4
  146. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
  147. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +165 -80
  148. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +1 -5
  149. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +73 -33
  150. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
  151. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +110 -17
  152. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +7 -2
  153. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
  154. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
  155. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
  156. data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
  157. data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
  158. data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
  159. data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
  160. data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
  161. data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
  162. data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
  163. data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
  164. data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
  165. data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
  166. data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
  167. data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
  168. data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
  169. data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
  170. data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
  171. data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +2 -2
  172. data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
  173. data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
  174. data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
  175. data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
  176. data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
  177. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +6 -3
  178. data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
  179. data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
  180. data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +8 -3
  181. data/dist/ice/cpp/src/Ice/WSAcceptor.h +5 -1
  182. data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +45 -2
  183. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +214 -34
  184. data/dist/ice/cpp/src/Ice/WSTransceiver.h +13 -2
  185. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
  186. data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
  187. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
  188. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
  189. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
  190. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
  191. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
  192. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
  193. data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
  194. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
  195. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
  196. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
  197. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +4 -2
  198. data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
  199. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
  200. data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
  201. data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
  202. data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
  203. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
  204. data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
  205. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
  206. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +32 -26
  207. data/dist/ice/cpp/src/Slice/DocCommentParser.h +6 -4
  208. data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
  209. data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
  210. data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
  211. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +34 -14
  212. data/dist/ice/cpp/src/Slice/MetadataValidation.h +3 -2
  213. data/dist/ice/cpp/src/Slice/Parser.cpp +145 -97
  214. data/dist/ice/cpp/src/Slice/Parser.h +22 -8
  215. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +77 -29
  216. data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -3
  217. data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
  218. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +203 -172
  219. data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
  220. data/dist/ice/cpp/src/Slice/Util.h +21 -12
  221. data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
  222. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +26 -20
  223. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +10 -13
  224. data/dist/ice/slice/Glacier2/Router.ice +3 -3
  225. data/dist/ice/slice/Ice/Identity.ice +3 -0
  226. data/dist/ice/slice/Ice/Locator.ice +6 -5
  227. data/dist/ice/slice/Ice/LocatorRegistry.ice +3 -0
  228. data/dist/ice/slice/Ice/Metrics.ice +7 -6
  229. data/dist/ice/slice/Ice/OperationMode.ice +8 -0
  230. data/dist/ice/slice/Ice/Process.ice +3 -0
  231. data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
  232. data/dist/ice/slice/Ice/ReplyStatus.ice +13 -0
  233. data/dist/ice/slice/IceGrid/Admin.ice +9 -9
  234. data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
  235. data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
  236. data/dist/lib/Glacier2/Metrics.rb +1 -1
  237. data/dist/lib/Glacier2/PermissionsVerifier.rb +3 -3
  238. data/dist/lib/Glacier2/Router.rb +9 -9
  239. data/dist/lib/Glacier2/SSLInfo.rb +1 -1
  240. data/dist/lib/Glacier2/Session.rb +15 -15
  241. data/dist/lib/Ice/BuiltinSequences.rb +1 -1
  242. data/dist/lib/Ice/CompressBatch.rb +1 -2
  243. data/dist/lib/Ice/Context.rb +1 -1
  244. data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
  245. data/dist/lib/Ice/EndpointTypes.rb +1 -1
  246. data/dist/lib/Ice/Identity.rb +1 -1
  247. data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
  248. data/dist/lib/Ice/LocalExceptions.rb +3 -0
  249. data/dist/lib/Ice/Locator.rb +5 -5
  250. data/dist/lib/Ice/LocatorRegistry.rb +4 -4
  251. data/dist/lib/Ice/Metrics.rb +7 -7
  252. data/dist/lib/Ice/OperationMode.rb +2 -3
  253. data/dist/lib/Ice/Process.rb +3 -3
  254. data/dist/lib/Ice/PropertiesAdmin.rb +4 -4
  255. data/dist/lib/Ice/PropertyDict.rb +1 -1
  256. data/dist/lib/Ice/ProxyFunctions.rb +8 -4
  257. data/dist/lib/Ice/RemoteLogger.rb +7 -8
  258. data/dist/lib/Ice/ReplyStatus.rb +4 -4
  259. data/dist/lib/Ice/Router.rb +5 -5
  260. data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
  261. data/dist/lib/Ice/SliceUtil.rb +2 -2
  262. data/dist/lib/Ice/Struct.rb +1 -0
  263. data/dist/lib/Ice/ToStringMode.rb +1 -2
  264. data/dist/lib/Ice/Value.rb +2 -2
  265. data/dist/lib/Ice/Version.rb +1 -1
  266. data/dist/lib/IceBox/ServiceManager.rb +8 -8
  267. data/dist/lib/IceGrid/Admin.rb +85 -86
  268. data/dist/lib/IceGrid/Descriptor.rb +1 -1
  269. data/dist/lib/IceGrid/Exception.rb +1 -1
  270. data/dist/lib/IceGrid/FileParser.rb +2 -2
  271. data/dist/lib/IceGrid/Registry.rb +14 -15
  272. data/dist/lib/IceGrid/Session.rb +7 -7
  273. data/dist/lib/IceGrid/UserAccountMapper.rb +2 -2
  274. data/dist/lib/IceStorm/IceStorm.rb +16 -16
  275. data/dist/lib/IceStorm/Metrics.rb +1 -1
  276. data/extconf.rb +1 -1
  277. data/ice.gemspec +3 -3
  278. metadata +5 -5
  279. data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
  280. data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
@@ -1,29 +1,90 @@
1
1
  // Copyright (c) ZeroC, Inc.
2
2
 
3
+ #ifdef _WIN32
4
+ # define _CRT_RAND_S
5
+ #endif
6
+
3
7
  #include "Random.h"
4
8
 
9
+ #include <array>
5
10
  #include <cassert>
11
+ #include <cstdint>
12
+ #include <cstdlib>
13
+ #include <cstring>
14
+ #include <system_error>
15
+
16
+ #if defined(__linux__)
17
+ # include <cerrno>
18
+ # include <sys/random.h>
19
+ #endif
6
20
 
7
21
  using namespace std;
8
22
 
23
+ // Generate the random bytes with the operating system's CSPRNG, never with std::random_device: the C++
24
+ // standard gives std::random_device no cryptographic guarantee, and some implementations draw from raw CPU
25
+ // entropy instructions whose output defective hardware can make predictable.
9
26
  void
10
27
  IceInternal::generateRandom(char* buffer, size_t size)
11
28
  {
12
- // We use the random_device directly here to get cryptographic random numbers when possible.
13
- thread_local static std::random_device rd;
14
- uniform_int_distribution<unsigned int> distribution(0, 255);
15
- for (size_t i = 0; i < size; ++i, ++buffer)
29
+ #if defined(_WIN32)
30
+ // rand_s is backed by the same system CSPRNG as BCryptGenRandom and requires no additional link
31
+ // dependency.
32
+ size_t index = 0;
33
+ while (index < size)
34
+ {
35
+ unsigned int r = 0;
36
+ errno_t err = rand_s(&r);
37
+ if (err != 0)
38
+ {
39
+ throw system_error(err, generic_category(), "rand_s failed");
40
+ }
41
+ size_t n = min(sizeof(r), size - index);
42
+ memcpy(buffer + index, &r, n);
43
+ index += n;
44
+ }
45
+ #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
46
+ arc4random_buf(buffer, size);
47
+ #elif defined(__linux__)
48
+ // getrandom with flags == 0 deliberately blocks until the kernel's entropy pool is initialized; don't
49
+ // "fix" this with GRND_NONBLOCK. There is also deliberately no /dev/urandom fallback here: getrandom is
50
+ // available in every supported glibc (2.25+), so a failure is a real error, not a missing feature.
51
+ size_t index = 0;
52
+ while (index < size)
16
53
  {
17
- *buffer = static_cast<char>(distribution(rd));
54
+ ssize_t n = getrandom(buffer + index, size - index, 0);
55
+ if (n <= 0)
56
+ {
57
+ if (n < 0 && errno == EINTR)
58
+ {
59
+ continue;
60
+ }
61
+ if (n == 0)
62
+ {
63
+ throw system_error(EIO, generic_category(), "getrandom returned no data");
64
+ }
65
+ throw system_error(errno, generic_category(), "getrandom failed");
66
+ }
67
+ index += static_cast<size_t>(n);
18
68
  }
69
+ #else
70
+ # error "unsupported platform: no OS CSPRNG binding"
71
+ #endif
19
72
  }
20
73
 
21
74
  unsigned int
22
75
  IceInternal::random(unsigned int limit)
23
76
  {
24
77
  assert(limit > 0);
25
- thread_local static std::random_device rd;
26
- thread_local static std::mt19937 rng(rd());
78
+ thread_local static mt19937 rng = createMT19937();
27
79
  uniform_int_distribution<unsigned int> distribution(0, limit - 1);
28
80
  return distribution(rng);
29
81
  }
82
+
83
+ mt19937
84
+ IceInternal::createMT19937()
85
+ {
86
+ array<uint32_t, 8> seedData;
87
+ generateRandom(reinterpret_cast<char*>(seedData.data()), sizeof(seedData));
88
+ seed_seq seq(seedData.begin(), seedData.end());
89
+ return mt19937(seq);
90
+ }
@@ -9,13 +9,17 @@
9
9
 
10
10
  namespace IceInternal
11
11
  {
12
+ // Fills the buffer with cryptographically strong random bytes from the operating system's CSPRNG.
12
13
  ICE_API void generateRandom(char*, size_t);
14
+
13
15
  ICE_API unsigned int random(unsigned int = 0);
14
16
 
17
+ // Creates a std::mt19937 engine seeded from the operating system's CSPRNG.
18
+ ICE_API std::mt19937 createMT19937();
19
+
15
20
  template<class T> void shuffle(T first, T last)
16
21
  {
17
- thread_local static std::random_device rd;
18
- thread_local static std::mt19937 rng(rd());
22
+ thread_local static std::mt19937 rng = createMT19937();
19
23
  std::shuffle(first, last, rng);
20
24
  }
21
25
  }
@@ -549,7 +549,7 @@ IceInternal::FixedReference::changeConnectionId(string) const
549
549
  ReferencePtr
550
550
  IceInternal::FixedReference::changeConnection(Ice::ConnectionIPtr newConnection) const
551
551
  {
552
- FixedReferencePtr r = dynamic_pointer_cast<FixedReference>(clone());
552
+ FixedReferencePtr r = static_pointer_cast<FixedReference>(clone());
553
553
  r->_fixedConnection = std::move(newConnection);
554
554
  return r;
555
555
  }
@@ -787,7 +787,7 @@ IceInternal::RoutableReference::changeEncoding(Ice::EncodingVersion encoding) co
787
787
  ReferencePtr r = Reference::changeEncoding(encoding);
788
788
  if (r.get() != const_cast<RoutableReference*>(this))
789
789
  {
790
- LocatorInfoPtr& locInfo = dynamic_pointer_cast<RoutableReference>(r)->_locatorInfo;
790
+ LocatorInfoPtr& locInfo = static_pointer_cast<RoutableReference>(r)->_locatorInfo;
791
791
  if (locInfo && locInfo->getLocator()->ice_getEncodingVersion() != encoding)
792
792
  {
793
793
  locInfo = getInstance()->locatorManager()->get(locInfo->getLocator()->ice_encodingVersion(encoding));
@@ -809,7 +809,7 @@ IceInternal::RoutableReference::changeCompress(bool newCompress) const
809
809
  {
810
810
  newEndpoints.push_back(endpoint->compress(newCompress));
811
811
  }
812
- dynamic_pointer_cast<RoutableReference>(r)->_endpoints = newEndpoints;
812
+ static_pointer_cast<RoutableReference>(r)->_endpoints = std::move(newEndpoints);
813
813
  }
814
814
  return r;
815
815
  }
@@ -817,7 +817,7 @@ IceInternal::RoutableReference::changeCompress(bool newCompress) const
817
817
  ReferencePtr
818
818
  IceInternal::RoutableReference::changeEndpoints(vector<EndpointIPtr> newEndpoints) const
819
819
  {
820
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
820
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
821
821
  r->_endpoints = std::move(newEndpoints);
822
822
  r->applyOverrides(r->_endpoints);
823
823
  r->_adapterId.clear();
@@ -827,7 +827,7 @@ IceInternal::RoutableReference::changeEndpoints(vector<EndpointIPtr> newEndpoint
827
827
  ReferencePtr
828
828
  IceInternal::RoutableReference::changeAdapterId(string newAdapterId) const
829
829
  {
830
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
830
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
831
831
  r->_adapterId = std::move(newAdapterId);
832
832
  r->_endpoints.clear();
833
833
  return r;
@@ -837,7 +837,7 @@ ReferencePtr
837
837
  IceInternal::RoutableReference::changeLocator(optional<LocatorPrx> newLocator) const
838
838
  {
839
839
  LocatorInfoPtr newLocatorInfo = newLocator ? getInstance()->locatorManager()->get(newLocator.value()) : nullptr;
840
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
840
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
841
841
  r->_locatorInfo = std::move(newLocatorInfo);
842
842
  return r;
843
843
  }
@@ -846,7 +846,7 @@ ReferencePtr
846
846
  IceInternal::RoutableReference::changeRouter(optional<RouterPrx> newRouter) const
847
847
  {
848
848
  RouterInfoPtr newRouterInfo = newRouter ? getInstance()->routerManager()->get(newRouter.value()) : nullptr;
849
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
849
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
850
850
  r->_routerInfo = std::move(newRouterInfo);
851
851
  return r;
852
852
  }
@@ -854,7 +854,7 @@ IceInternal::RoutableReference::changeRouter(optional<RouterPrx> newRouter) cons
854
854
  ReferencePtr
855
855
  IceInternal::RoutableReference::changeCollocationOptimized(bool newCollocationOptimized) const
856
856
  {
857
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
857
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
858
858
  r->_collocationOptimized = newCollocationOptimized;
859
859
  return r;
860
860
  }
@@ -862,7 +862,7 @@ IceInternal::RoutableReference::changeCollocationOptimized(bool newCollocationOp
862
862
  ReferencePtr
863
863
  IceInternal::RoutableReference::changeCacheConnection(bool newCache) const
864
864
  {
865
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
865
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
866
866
  r->_cacheConnection = newCache;
867
867
  return r;
868
868
  }
@@ -870,7 +870,7 @@ IceInternal::RoutableReference::changeCacheConnection(bool newCache) const
870
870
  ReferencePtr
871
871
  IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType newType) const
872
872
  {
873
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
873
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
874
874
  r->_endpointSelection = newType;
875
875
  return r;
876
876
  }
@@ -878,7 +878,7 @@ IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType ne
878
878
  ReferencePtr
879
879
  IceInternal::RoutableReference::changeLocatorCacheTimeout(chrono::milliseconds timeout) const
880
880
  {
881
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
881
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
882
882
  r->_locatorCacheTimeout = timeout;
883
883
  return r;
884
884
  }
@@ -886,7 +886,7 @@ IceInternal::RoutableReference::changeLocatorCacheTimeout(chrono::milliseconds t
886
886
  ReferencePtr
887
887
  IceInternal::RoutableReference::changeConnectionId(string id) const
888
888
  {
889
- RoutableReferencePtr r = dynamic_pointer_cast<RoutableReference>(clone());
889
+ RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
890
890
  r->_connectionId = id;
891
891
  if (!_endpoints.empty()) // Also override the connection id on the endpoints.
892
892
  {
@@ -896,7 +896,7 @@ IceInternal::RoutableReference::changeConnectionId(string id) const
896
896
  {
897
897
  newEndpoints.push_back(endpoint->connectionId(id));
898
898
  }
899
- r->_endpoints = newEndpoints;
899
+ r->_endpoints = std::move(newEndpoints);
900
900
  }
901
901
  return r;
902
902
  }
@@ -1013,9 +1013,15 @@ IceInternal::RoutableReference::toProperty(string prefix) const
1013
1013
  properties[prefix + ".ConnectionCached"] = _cacheConnection ? "1" : "0";
1014
1014
  properties[prefix + ".EndpointSelection"] =
1015
1015
  _endpointSelection == EndpointSelectionType::Random ? "Random" : "Ordered";
1016
+ // An invocation timeout of zero or any negative timeout means infinite; a negative locator cache timeout also
1017
+ // means infinite. We emit these as -1, the documented value for infinite. A positive timeout that is not a whole
1018
+ // number of the property's unit is rounded up, to the next whole number.
1019
+ // TODO: remove this normalization in 3.9, once the timeouts are always normalized: in 3.8, code compiled
1020
+ // against older headers can still set non-normalized values.
1016
1021
  properties[prefix + ".LocatorCacheTimeout"] =
1017
- to_string(chrono::duration_cast<chrono::seconds>(_locatorCacheTimeout).count());
1018
- properties[prefix + ".InvocationTimeout"] = to_string(getInvocationTimeout().count());
1022
+ _locatorCacheTimeout < 0ms ? "-1" : to_string(chrono::ceil<chrono::seconds>(_locatorCacheTimeout).count());
1023
+ chrono::milliseconds invocationTimeout = getInvocationTimeout();
1024
+ properties[prefix + ".InvocationTimeout"] = invocationTimeout <= 0ms ? "-1" : to_string(invocationTimeout.count());
1019
1025
 
1020
1026
  if (_routerInfo)
1021
1027
  {
@@ -1200,7 +1206,12 @@ IceInternal::RoutableReference::operator<(const Reference& r) const noexcept
1200
1206
  {
1201
1207
  return true;
1202
1208
  }
1203
- else if (rhs->_endpoints < _endpoints)
1209
+ else if (lexicographical_compare(
1210
+ rhs->_endpoints.begin(),
1211
+ rhs->_endpoints.end(),
1212
+ _endpoints.begin(),
1213
+ _endpoints.end(),
1214
+ Ice::TargetCompare<shared_ptr<EndpointI>, std::less>()))
1204
1215
  {
1205
1216
  return false;
1206
1217
  }
@@ -1259,7 +1270,7 @@ IceInternal::RoutableReference::getConnectionAsync(
1259
1270
  if (_routerInfo)
1260
1271
  {
1261
1272
  // If we route, we send everything to the router's client proxy endpoints.
1262
- auto self = dynamic_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
1273
+ auto self = static_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
1263
1274
 
1264
1275
  _routerInfo->getClientEndpointsAsync(
1265
1276
  [self = std::move(self), response = std::move(response), exception](vector<EndpointIPtr> endpoints) mutable
@@ -1364,7 +1375,7 @@ IceInternal::RoutableReference::getConnectionNoRouterInfoAsync(
1364
1375
  if (_locatorInfo)
1365
1376
  {
1366
1377
  RoutableReferencePtr self =
1367
- dynamic_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
1378
+ static_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
1368
1379
  _locatorInfo->getEndpoints(
1369
1380
  self,
1370
1381
  _locatorCacheTimeout,
@@ -1398,7 +1409,7 @@ IceInternal::RoutableReference::createConnectionAsync(
1398
1409
  OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
1399
1410
  auto self = static_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
1400
1411
 
1401
- auto createConnectionSucceded =
1412
+ auto createConnectionSucceeded =
1402
1413
  [routerInfo = _routerInfo, response = std::move(response)](Ice::ConnectionIPtr connection, bool compress)
1403
1414
  {
1404
1415
  // If we have a router, set the object adapter for this router (if any) to the new connection, so that
@@ -1413,7 +1424,7 @@ IceInternal::RoutableReference::createConnectionAsync(
1413
1424
  if (getCacheConnection() || endpoints.size() == 1)
1414
1425
  {
1415
1426
  // Get an existing connection or create one if there's no existing connection to one of the given endpoints.
1416
- factory->createAsync(std::move(endpoints), false, std::move(createConnectionSucceded), std::move(exception));
1427
+ factory->createAsync(std::move(endpoints), false, std::move(createConnectionSucceeded), std::move(exception));
1417
1428
  }
1418
1429
  else
1419
1430
  {
@@ -1427,11 +1438,11 @@ IceInternal::RoutableReference::createConnectionAsync(
1427
1438
  CreateConnectionState(
1428
1439
  vector<EndpointIPtr> endpoints,
1429
1440
  OutgoingConnectionFactoryPtr factory,
1430
- function<void(Ice::ConnectionIPtr, bool)> createConnectionSucceded,
1441
+ function<void(Ice::ConnectionIPtr, bool)> createConnectionSucceeded,
1431
1442
  function<void(exception_ptr)> exception)
1432
1443
  : _endpoints(std::move(endpoints)),
1433
1444
  _factory(std::move(factory)),
1434
- _createConnectionSucceded(std::move(createConnectionSucceded)),
1445
+ _createConnectionSucceeded(std::move(createConnectionSucceeded)),
1435
1446
  _createConnectionFailed(std::move(exception))
1436
1447
  {
1437
1448
  }
@@ -1441,7 +1452,7 @@ IceInternal::RoutableReference::createConnectionAsync(
1441
1452
  _factory->createAsync(
1442
1453
  {_endpoints[_endpointIndex]},
1443
1454
  true,
1444
- _createConnectionSucceded,
1455
+ _createConnectionSucceeded,
1445
1456
  [self = shared_from_this()](exception_ptr e) { self->handleException(e); });
1446
1457
  }
1447
1458
 
@@ -1462,7 +1473,7 @@ IceInternal::RoutableReference::createConnectionAsync(
1462
1473
  _factory->createAsync(
1463
1474
  {_endpoints[_endpointIndex]},
1464
1475
  more,
1465
- _createConnectionSucceded,
1476
+ _createConnectionSucceeded,
1466
1477
  [self = shared_from_this()](exception_ptr e) { self->handleException(e); });
1467
1478
  }
1468
1479
 
@@ -1471,14 +1482,14 @@ IceInternal::RoutableReference::createConnectionAsync(
1471
1482
  size_t _endpointIndex = 0;
1472
1483
  vector<EndpointIPtr> _endpoints;
1473
1484
  OutgoingConnectionFactoryPtr _factory;
1474
- std::function<void(Ice::ConnectionIPtr, bool)> _createConnectionSucceded;
1485
+ std::function<void(Ice::ConnectionIPtr, bool)> _createConnectionSucceeded;
1475
1486
  std::function<void(exception_ptr)> _createConnectionFailed;
1476
1487
  };
1477
1488
 
1478
1489
  auto state = make_shared<CreateConnectionState>(
1479
1490
  std::move(endpoints),
1480
1491
  std::move(factory),
1481
- std::move(createConnectionSucceded),
1492
+ std::move(createConnectionSucceeded),
1482
1493
  std::move(exception));
1483
1494
  state->createAsync();
1484
1495
  }
@@ -209,6 +209,9 @@ namespace IceInternal
209
209
  [[nodiscard]] RequestHandlerPtr getRequestHandler() const final;
210
210
  [[nodiscard]] const BatchRequestQueuePtr& getBatchRequestQueue() const noexcept final;
211
211
 
212
+ // The connection this fixed reference is bound to, whatever its state.
213
+ [[nodiscard]] const Ice::ConnectionIPtr& fixedConnection() const noexcept { return _fixedConnection; }
214
+
212
215
  bool operator==(const Reference&) const noexcept final;
213
216
  bool operator<(const Reference&) const noexcept final;
214
217
 
@@ -93,13 +93,14 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
93
93
  return nullptr;
94
94
  }
95
95
 
96
- const string delim = " \t\r\n";
96
+ static constexpr const char* whitespace = " \t\r\n";
97
+ static constexpr const char* whitespaceOrSeparator = " \t\r\n:@";
97
98
 
98
- string s(str);
99
+ string s{str};
99
100
  string::size_type beg;
100
101
  string::size_type end = 0;
101
102
 
102
- beg = s.find_first_not_of(delim, end);
103
+ beg = s.find_first_not_of(whitespace, end);
103
104
  if (beg == string::npos)
104
105
  {
105
106
  throw ParseException(__FILE__, __LINE__, "no non-whitespace characters found in proxy string '" + s + "'");
@@ -117,7 +118,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
117
118
  }
118
119
  else if (end == 0)
119
120
  {
120
- end = s.find_first_of(delim + ":@", beg);
121
+ end = s.find_first_of(whitespaceOrSeparator, beg);
121
122
  if (end == string::npos)
122
123
  {
123
124
  end = s.size();
@@ -144,7 +145,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
144
145
  // a null proxy, but only if nothing follows the
145
146
  // quotes.
146
147
  //
147
- if (s.find_first_not_of(delim, end) != string::npos)
148
+ if (s.find_first_not_of(whitespace, end) != string::npos)
148
149
  {
149
150
  throw ParseException(__FILE__, __LINE__, "invalid characters after identity in proxy string '" + s + "'");
150
151
  }
@@ -167,7 +168,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
167
168
 
168
169
  while (true)
169
170
  {
170
- beg = s.find_first_not_of(delim, end);
171
+ beg = s.find_first_not_of(whitespace, end);
171
172
  if (beg == string::npos)
172
173
  {
173
174
  break;
@@ -178,7 +179,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
178
179
  break;
179
180
  }
180
181
 
181
- end = s.find_first_of(delim + ":@", beg);
182
+ end = s.find_first_of(whitespaceOrSeparator, beg);
182
183
  if (end == string::npos)
183
184
  {
184
185
  end = s.length();
@@ -204,7 +205,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
204
205
  // quotation marks.
205
206
  //
206
207
  string argument;
207
- string::size_type argumentBeg = s.find_first_not_of(delim, end);
208
+ string::size_type argumentBeg = s.find_first_not_of(whitespace, end);
208
209
  if (argumentBeg != string::npos)
209
210
  {
210
211
  if (s[argumentBeg] != '@' && s[argumentBeg] != ':' && s[argumentBeg] != '-')
@@ -220,7 +221,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
220
221
  }
221
222
  else if (end == 0)
222
223
  {
223
- end = s.find_first_of(delim + ":@", beg);
224
+ end = s.find_first_of(whitespaceOrSeparator, beg);
224
225
  if (end == string::npos)
225
226
  {
226
227
  end = s.size();
@@ -493,7 +494,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
493
494
  }
494
495
  case '@':
495
496
  {
496
- beg = s.find_first_not_of(delim, beg + 1);
497
+ beg = s.find_first_not_of(whitespace, beg + 1);
497
498
  if (beg == string::npos)
498
499
  {
499
500
  throw ParseException(__FILE__, __LINE__, "missing adapter id in proxy string '" + s + "'");
@@ -510,7 +511,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
510
511
  }
511
512
  else if (end == 0)
512
513
  {
513
- end = s.find_first_of(delim, beg);
514
+ end = s.find_first_of(whitespace, beg);
514
515
  if (end == string::npos)
515
516
  {
516
517
  end = s.size();
@@ -525,7 +526,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
525
526
  }
526
527
 
527
528
  // Check for trailing whitespace.
528
- if (end != string::npos && s.find_first_not_of(delim, end) != string::npos)
529
+ if (end != string::npos && s.find_first_not_of(whitespace, end) != string::npos)
529
530
  {
530
531
  throw ParseException(
531
532
  __FILE__,
@@ -610,7 +611,9 @@ IceInternal::ReferenceFactory::create(Identity ident, InputStream* s)
610
611
  vector<EndpointIPtr> endpoints;
611
612
  string adapterId;
612
613
 
613
- int32_t sz = s->readSize();
614
+ // Each endpoint occupies at least 8 bytes on the wire (a 2-byte type plus a 6-byte minimum
615
+ // encapsulation), so readAndCheckSeqSize rejects an oversized count before we allocate.
616
+ int32_t sz = s->readAndCheckSeqSize(8);
614
617
 
615
618
  if (sz > 0)
616
619
  {
@@ -792,10 +795,20 @@ IceInternal::ReferenceFactory::create(
792
795
  property = propertyPrefix + ".LocatorCacheTimeout";
793
796
  locatorCacheTimeout = chrono::seconds(
794
797
  properties->getPropertyAsIntWithDefault(property, static_cast<int32_t>(locatorCacheTimeout.count())));
798
+ if (locatorCacheTimeout < chrono::seconds::zero())
799
+ {
800
+ // Any negative timeout means infinite and is normalized to -1; 0 means no caching.
801
+ locatorCacheTimeout = chrono::seconds(-1);
802
+ }
795
803
 
796
804
  property = propertyPrefix + ".InvocationTimeout";
797
805
  invocationTimeout = chrono::milliseconds(
798
806
  properties->getPropertyAsIntWithDefault(property, static_cast<int32_t>(invocationTimeout.count())));
807
+ if (invocationTimeout <= chrono::milliseconds::zero())
808
+ {
809
+ // Zero or any negative timeout means infinite and is normalized to -1.
810
+ invocationTimeout = chrono::milliseconds(-1);
811
+ }
799
812
 
800
813
  property = propertyPrefix + ".Context.";
801
814
  PropertyDict contexts = properties->getPropertiesForPrefix(property);
@@ -42,7 +42,9 @@ namespace IceInternal
42
42
 
43
43
  virtual AsyncStatus sendAsyncRequest(const ProxyOutgoingAsyncBasePtr&) = 0;
44
44
 
45
- virtual Ice::ConnectionIPtr getConnection() = 0;
45
+ // Returns this request handler's connection, or null if no connection is available. This function never
46
+ // throws.
47
+ virtual Ice::ConnectionIPtr getConnection() noexcept = 0;
46
48
 
47
49
  protected:
48
50
  const ReferencePtr _reference;
@@ -45,7 +45,7 @@ RequestHandlerCache::getRequestHandler()
45
45
  }
46
46
 
47
47
  ConnectionPtr
48
- RequestHandlerCache::getCachedConnection()
48
+ RequestHandlerCache::getCachedConnection() noexcept
49
49
  {
50
50
  if (_cacheConnection)
51
51
  {
@@ -18,7 +18,7 @@ namespace IceInternal
18
18
 
19
19
  RequestHandlerPtr getRequestHandler();
20
20
 
21
- Ice::ConnectionPtr getCachedConnection();
21
+ Ice::ConnectionPtr getCachedConnection() noexcept;
22
22
 
23
23
  void clearCachedRequestHandler(const RequestHandlerPtr& handler);
24
24
 
@@ -5,8 +5,8 @@
5
5
 
6
6
  #include "winver.h"
7
7
 
8
- #define ICE_VERSION 3, 8, 1, 0
9
- #define ICE_STRING_VERSION "3.8.1\0"
8
+ #define ICE_VERSION 3, 8, 3, 0
9
+ #define ICE_STRING_VERSION "3.8.3\0"
10
10
  #define ICE_SO_VERSION "38\0"
11
11
  #define ICE_COMPANY_NAME "ZeroC, Inc.\0"
12
12
  #define ICE_COPYRIGHT "\251 ZeroC, Inc.\0"
@@ -18,7 +18,7 @@
18
18
  # define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION ""
19
19
  #endif
20
20
 
21
- #ifndef DEBUG
21
+ #ifndef _DEBUG
22
22
  # define VER_DEBUG 0
23
23
  #else
24
24
  # define VER_DEBUG VS_FF_DEBUG
@@ -26,8 +26,8 @@ IceInternal::RetryTask::runTimerTask()
26
26
  _outAsync->retry(); // Retry again the invocation.
27
27
 
28
28
  //
29
- // NOTE: this must be called last, destroy() blocks until all task
30
- // are removed to prevent the client thread pool to be destroyed
29
+ // NOTE: this must be called last, destroy() blocks until all tasks
30
+ // are removed to prevent the client thread pool from being destroyed
31
31
  // (we still need the client thread pool at this point to call
32
32
  // exception callbacks with CommunicatorDestroyedException).
33
33
  //
@@ -135,17 +135,13 @@ bool
135
135
  IceInternal::RetryQueue::cancel(const RetryTaskPtr& task)
136
136
  {
137
137
  lock_guard<mutex> lock(_mutex);
138
- if (_requests.erase(task) > 0)
138
+ // Only remove the task if we cancel it in the timer before it runs. If timer()->cancel returns false, the
139
+ // task is already executing and runTimerTask will call remove() to erase it from _requests; erasing it
140
+ // here would make that remove() fail its assertion. When the queue is being destroyed (_instance is null)
141
+ // the timer is gone and every remaining task is running, so it is likewise removed by remove().
142
+ if (_instance && _instance->timer()->cancel(task))
139
143
  {
140
- if (_instance)
141
- {
142
- return _instance->timer()->cancel(task);
143
- }
144
- else if (_requests.empty())
145
- {
146
- // If we are destroying the queue, destroy is probably waiting on the queue to be empty.
147
- _conditionVariable.notify_one();
148
- }
144
+ return _requests.erase(task) != 0;
149
145
  }
150
146
  return false;
151
147
  }
@@ -105,16 +105,16 @@ IceInternal::SHA1::Hasher::finalize(vector<unsigned char>& md)
105
105
  #if defined(_WIN32)
106
106
  md.resize(SHA_DIGEST_LENGTH);
107
107
  DWORD length = SHA_DIGEST_LENGTH;
108
- if (!CryptGetHashParam(_hash, HP_HASHVAL, &md[0], &length, 0))
108
+ if (!CryptGetHashParam(_hash, HP_HASHVAL, md.data(), &length, 0))
109
109
  {
110
110
  throw Ice::SyscallException{__FILE__, __LINE__, "CryptGetHashParam failed", GetLastError()};
111
111
  }
112
112
  #elif defined(__APPLE__)
113
113
  md.resize(CC_SHA1_DIGEST_LENGTH);
114
- CC_SHA1_Final(&md[0], &_ctx);
114
+ CC_SHA1_Final(md.data(), &_ctx);
115
115
  #else
116
116
  md.resize(SHA_DIGEST_LENGTH);
117
- SHA1_Final(&md[0], &_ctx);
117
+ SHA1_Final(md.data(), &_ctx);
118
118
  #endif
119
119
  }
120
120
 
@@ -124,16 +124,16 @@ IceInternal::SHA1::Hasher::finalize(vector<byte>& md)
124
124
  #if defined(_WIN32)
125
125
  md.resize(SHA_DIGEST_LENGTH);
126
126
  DWORD length = SHA_DIGEST_LENGTH;
127
- if (!CryptGetHashParam(_hash, HP_HASHVAL, reinterpret_cast<unsigned char*>(&md[0]), &length, 0))
127
+ if (!CryptGetHashParam(_hash, HP_HASHVAL, reinterpret_cast<unsigned char*>(md.data()), &length, 0))
128
128
  {
129
129
  throw Ice::SyscallException{__FILE__, __LINE__, "CryptGetHashParam failed", GetLastError()};
130
130
  }
131
131
  #elif defined(__APPLE__)
132
132
  md.resize(CC_SHA1_DIGEST_LENGTH);
133
- CC_SHA1_Final(reinterpret_cast<unsigned char*>(&md[0]), &_ctx);
133
+ CC_SHA1_Final(reinterpret_cast<unsigned char*>(md.data()), &_ctx);
134
134
  #else
135
135
  md.resize(SHA_DIGEST_LENGTH);
136
- SHA1_Final(reinterpret_cast<unsigned char*>(&md[0]), &_ctx);
136
+ SHA1_Final(reinterpret_cast<unsigned char*>(md.data()), &_ctx);
137
137
  #endif
138
138
  }
139
139
 
@@ -168,10 +168,10 @@ IceInternal::sha1(const unsigned char* data, size_t length, vector<unsigned char
168
168
  hasher.finalize(md);
169
169
  #elif defined(__APPLE__)
170
170
  md.resize(CC_SHA1_DIGEST_LENGTH);
171
- CC_SHA1(&data[0], static_cast<CC_LONG>(length), &md[0]);
171
+ CC_SHA1(data, static_cast<CC_LONG>(length), md.data());
172
172
  #else
173
173
  md.resize(SHA_DIGEST_LENGTH);
174
- ::SHA1(&data[0], length, &md[0]);
174
+ ::SHA1(data, length, md.data());
175
175
  #endif
176
176
  }
177
177
 
@@ -185,11 +185,11 @@ IceInternal::sha1(const byte* data, size_t length, vector<byte>& md)
185
185
  #elif defined(__APPLE__)
186
186
  md.resize(CC_SHA1_DIGEST_LENGTH);
187
187
  CC_SHA1(
188
- reinterpret_cast<const unsigned char*>(&data[0]),
188
+ reinterpret_cast<const unsigned char*>(data),
189
189
  static_cast<CC_LONG>(length),
190
- reinterpret_cast<unsigned char*>(&md[0]));
190
+ reinterpret_cast<unsigned char*>(md.data()));
191
191
  #else
192
192
  md.resize(SHA_DIGEST_LENGTH);
193
- ::SHA1(reinterpret_cast<const unsigned char*>(&data[0]), length, reinterpret_cast<unsigned char*>(&md[0]));
193
+ ::SHA1(reinterpret_cast<const unsigned char*>(data), length, reinterpret_cast<unsigned char*>(md.data()));
194
194
  #endif
195
195
  }
@@ -51,12 +51,6 @@ DistinguishedName::match(const DistinguishedName& other) const
51
51
  return true;
52
52
  }
53
53
 
54
- bool
55
- DistinguishedName::match(const string& other) const
56
- {
57
- return match(DistinguishedName(other));
58
- }
59
-
60
54
  //
61
55
  // This always produces the same output as the input DN -- the type of
62
56
  // escaping is not changed.