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
@@ -12,7 +12,8 @@
12
12
  #include "Ice/Properties.h"
13
13
  #include "IdleTimeoutTransceiverDecorator.h"
14
14
  #include "Instance.h"
15
- #include "ObjectAdapterI.h" // For getThreadPool()
15
+ #include "ObjectAdapterI.h" // For getThreadPool()
16
+ #include "OutgoingResponseInternal.h"
16
17
  #include "ReferenceFactory.h" // For createProxy().
17
18
  #include "RequestHandler.h" // For RetryException
18
19
  #include "ThreadPool.h"
@@ -25,6 +26,7 @@
25
26
  #include <algorithm>
26
27
  #include <iomanip>
27
28
  #include <stdexcept>
29
+ #include <utility>
28
30
 
29
31
  #ifdef ICE_HAS_BZIP2
30
32
  # include <bzlib.h>
@@ -400,7 +402,11 @@ Ice::ConnectionI::startAsync(
400
402
  }
401
403
  catch (const Ice::LocalException&)
402
404
  {
403
- exception(current_exception());
405
+ {
406
+ std::lock_guard lock(_mutex);
407
+ setState(StateClosed, current_exception());
408
+ }
409
+
404
410
  if (connectionStartFailed)
405
411
  {
406
412
  connectionStartFailed(shared_from_this(), current_exception());
@@ -546,14 +552,14 @@ Ice::ConnectionI::close(function<void()> response, function<void(std::exception_
546
552
  {
547
553
  if (response)
548
554
  {
549
- response();
555
+ executeCallback(response);
550
556
  }
551
557
  }
552
558
  else
553
559
  {
554
560
  if (exception)
555
561
  {
556
- exception(closeException);
562
+ executeCallback([&] { exception(closeException); });
557
563
  }
558
564
  }
559
565
  }
@@ -571,30 +577,6 @@ Ice::ConnectionI::isActiveOrHolding() const
571
577
  return _state > StateNotValidated && _state < StateClosing;
572
578
  }
573
579
 
574
- bool
575
- Ice::ConnectionI::isFinished() const
576
- {
577
- //
578
- // We can use trylock here, because as long as there are still
579
- // threads operating in this connection object, connection
580
- // destruction is considered as not yet finished.
581
- //
582
- std::unique_lock<std::mutex> lock(_mutex, std::try_to_lock);
583
-
584
- if (!lock.owns_lock())
585
- {
586
- return false;
587
- }
588
-
589
- if (_state != StateFinished || _upcallCount != 0)
590
- {
591
- return false;
592
- }
593
-
594
- assert(_state == StateFinished);
595
- return true;
596
- }
597
-
598
580
  void
599
581
  Ice::ConnectionI::throwException() const
600
582
  {
@@ -661,7 +643,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
661
643
 
662
644
  std::lock_guard lock(_mutex);
663
645
  //
664
- // If the exception is closed before we even have a chance
646
+ // If the connection is closed before we even have a chance
665
647
  // to send our request, we always try to send the request
666
648
  // again.
667
649
  //
@@ -782,18 +764,27 @@ Ice::ConnectionI::flushBatchRequestsAsync(
782
764
  void
783
765
  Ice::ConnectionI::setCloseCallback(CloseCallback callback)
784
766
  {
785
- std::lock_guard lock(_mutex);
786
- if (_state >= StateClosed)
767
+ // Holds the callback this call replaces, so that it is destroyed after the lock is released. Destroying a
768
+ // callback can run arbitrary user code - a language mapping may attach a finalizer to it - and that code can
769
+ // call back into this connection, which would deadlock on the non-recursive _mutex.
770
+ CloseCallback previous;
771
+
787
772
  {
788
- if (callback)
773
+ std::lock_guard lock(_mutex);
774
+ if (_state >= StateClosed)
789
775
  {
790
- auto self = shared_from_this();
791
- _threadPool->execute([self, callback = std::move(callback)]() { self->closeCallback(callback); }, self);
776
+ if (callback)
777
+ {
778
+ auto self = shared_from_this();
779
+ _threadPool->execute(
780
+ [self, callback = std::move(callback)]() { self->executeCallback(callback); },
781
+ self);
782
+ }
783
+ }
784
+ else
785
+ {
786
+ previous = std::exchange(_closeCallback, std::move(callback));
792
787
  }
793
- }
794
- else
795
- {
796
- _closeCallback = std::move(callback);
797
788
  }
798
789
  }
799
790
 
@@ -806,11 +797,17 @@ Ice::ConnectionI::disableInactivityCheck() noexcept
806
797
  }
807
798
 
808
799
  void
809
- Ice::ConnectionI::closeCallback(const CloseCallback& callback)
800
+ Ice::ConnectionI::executeCallback(const CloseCallback& callback) noexcept
801
+ {
802
+ executeCallback([self = shared_from_this(), &callback] { callback(self); });
803
+ }
804
+
805
+ void
806
+ Ice::ConnectionI::executeCallback(const std::function<void()>& callback) noexcept
810
807
  {
811
808
  try
812
809
  {
813
- callback(shared_from_this());
810
+ callback();
814
811
  }
815
812
  catch (const std::exception& ex)
816
813
  {
@@ -1012,7 +1009,7 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter)
1012
1009
  {
1013
1010
  // Go through the adapter to set the adapter on this connection
1014
1011
  // to ensure the object adapter is still active.
1015
- dynamic_pointer_cast<ObjectAdapterI>(adapter)->setAdapterOnConnection(shared_from_this());
1012
+ static_pointer_cast<ObjectAdapterI>(adapter)->setAdapterOnConnection(shared_from_this());
1016
1013
  }
1017
1014
  else
1018
1015
  {
@@ -1594,7 +1591,7 @@ Ice::ConnectionI::finished(ThreadPoolCurrent& current, bool close)
1594
1591
  }
1595
1592
 
1596
1593
  // If there are no callbacks to call, we don't call ioCompleted() since we're not going to call code that will
1597
- // potentially block (this avoids promoting a new leader and unecessary thread creation, especially if this is
1594
+ // potentially block (this avoids promoting a new leader and unnecessary thread creation, especially if this is
1598
1595
  // called on shutdown).
1599
1596
  if (!_connectionStartCompleted && !_connectionStartFailed && _sendStreams.empty() && _asyncRequests.empty() &&
1600
1597
  !_closeCallback)
@@ -1790,14 +1787,14 @@ Ice::ConnectionI::finish(bool close)
1790
1787
  {
1791
1788
  if (pair.first)
1792
1789
  {
1793
- pair.first();
1790
+ executeCallback(pair.first);
1794
1791
  }
1795
1792
  }
1796
1793
  else
1797
1794
  {
1798
1795
  if (pair.second)
1799
1796
  {
1800
- pair.second(_exception);
1797
+ executeCallback([this, &pair] { pair.second(_exception); });
1801
1798
  }
1802
1799
  }
1803
1800
  }
@@ -1806,7 +1803,7 @@ Ice::ConnectionI::finish(bool close)
1806
1803
 
1807
1804
  if (_closeCallback)
1808
1805
  {
1809
- closeCallback(_closeCallback);
1806
+ executeCallback(_closeCallback);
1810
1807
  _closeCallback = nullptr;
1811
1808
  }
1812
1809
 
@@ -1869,17 +1866,19 @@ Ice::ConnectionI::setBufferSize(int32_t rcvSize, int32_t sndSize)
1869
1866
  {
1870
1867
  rethrow_exception(_exception);
1871
1868
  }
1872
- _transceiver->setBufferSize(rcvSize, sndSize);
1869
+ try
1870
+ {
1871
+ _transceiver->setBufferSize(rcvSize, sndSize);
1872
+ }
1873
+ catch (...)
1874
+ {
1875
+ // The failing call may have closed the socket, so close the connection as well.
1876
+ setState(StateClosed, current_exception());
1877
+ throw;
1878
+ }
1873
1879
  _info = nullptr; // Invalidate the cached connection info
1874
1880
  }
1875
1881
 
1876
- void
1877
- Ice::ConnectionI::exception(std::exception_ptr ex)
1878
- {
1879
- std::lock_guard lock(_mutex);
1880
- setState(StateClosed, ex);
1881
- }
1882
-
1883
1882
  Ice::ConnectionI::ConnectionI(
1884
1883
  CommunicatorPtr communicator,
1885
1884
  const InstancePtr& instance,
@@ -1888,7 +1887,7 @@ Ice::ConnectionI::ConnectionI(
1888
1887
  const EndpointIPtr& endpoint,
1889
1888
  const shared_ptr<ObjectAdapterI>& adapter,
1890
1889
  std::function<void(const ConnectionIPtr&)> removeFromFactory,
1891
- const ConnectionOptions& options) noexcept
1890
+ const ConnectionOptions& options)
1892
1891
  : _communicator(std::move(communicator)),
1893
1892
  _instance(instance),
1894
1893
  _transceiver(transceiver),
@@ -2179,7 +2178,7 @@ Ice::ConnectionI::setState(State state)
2179
2178
 
2180
2179
  //
2181
2180
  // Don't need to close now for connections so only close the transceiver
2182
- // if the selector request it.
2181
+ // if the selector requests it.
2183
2182
  //
2184
2183
  if (_threadPool->finish(shared_from_this(), false))
2185
2184
  {
@@ -2406,7 +2405,7 @@ Ice::ConnectionI::sendHeartbeat() noexcept
2406
2405
  }
2407
2406
 
2408
2407
  // We send a heartbeat to the peer to generate a "write" on the connection. This write in turns creates
2409
- // a read on the peer, and resets the peer's idle check timer. When _sendStream is not empty, there is
2408
+ // a read on the peer, and resets the peer's idle check timer. When _sendStreams is not empty, there is
2410
2409
  // already an outstanding write, so we don't need to send a heartbeat. It's possible the first message
2411
2410
  // of _sendStreams was already sent but not yet removed from _sendStreams: it means the last write
2412
2411
  // occurred very recently, which is good enough with respect to the idle check.
@@ -2441,74 +2440,71 @@ Ice::ConnectionI::sendResponse(OutgoingResponse response, uint8_t compress)
2441
2440
  {
2442
2441
  bool isTwoWay = !_endpoint->datagram() && response.current().requestId != 0;
2443
2442
 
2444
- bool finished = false;
2443
+ // We hold _mutex for the duration of this function, including the catch handler below; hence the lock is not
2444
+ // declared inside the try block.
2445
+ std::unique_lock lock(_mutex);
2446
+ assert(_state > StateNotValidated);
2447
+
2445
2448
  try
2446
2449
  {
2447
- std::unique_lock lock(_mutex);
2448
- assert(_state > StateNotValidated);
2450
+ bool finished = false;
2449
2451
 
2450
- try
2452
+ if (--_upcallCount == 0)
2451
2453
  {
2452
- if (--_upcallCount == 0)
2454
+ if (_state == StateFinished)
2453
2455
  {
2454
- if (_state == StateFinished)
2456
+ finished = true;
2457
+ if (_observer)
2455
2458
  {
2456
- finished = true;
2457
- if (_observer)
2458
- {
2459
- _observer.detach();
2460
- }
2459
+ _observer.detach();
2461
2460
  }
2462
- _conditionVariable.notify_all();
2463
2461
  }
2462
+ _conditionVariable.notify_all();
2463
+ }
2464
2464
 
2465
- if (_state >= StateClosed)
2466
- {
2467
- exception_ptr exception = _exception;
2468
- assert(exception);
2469
-
2470
- if (finished && _removeFromFactory)
2471
- {
2472
- lock.unlock();
2473
- _removeFromFactory(shared_from_this());
2474
- }
2475
-
2476
- rethrow_exception(exception);
2477
- }
2478
- assert(!finished);
2465
+ if (_state >= StateClosed)
2466
+ {
2467
+ // The connection is already closed (or finished): we can't send the response. There is nothing else to
2468
+ // do here since the connection's exception is already set.
2469
+ assert(_exception);
2479
2470
 
2480
- if (isTwoWay)
2471
+ if (finished && _removeFromFactory)
2481
2472
  {
2482
- OutgoingMessage message(&response.outputStream(), compress > 0);
2483
- sendMessage(message);
2473
+ lock.unlock();
2474
+ _removeFromFactory(shared_from_this());
2484
2475
  }
2485
2476
 
2486
- if (_state == StateActive && _maxDispatches > 0 && _dispatchCount == _maxDispatches)
2487
- {
2488
- // Resume reading if the connection is active and the dispatch count is about to be less than
2489
- // _maxDispatches.
2490
- _threadPool->update(shared_from_this(), SocketOperationNone, SocketOperationRead);
2491
- if (_idleTimeoutTransceiver)
2492
- {
2493
- _idleTimeoutTransceiver->enableIdleCheck();
2494
- }
2495
- }
2477
+ return;
2478
+ }
2479
+ assert(!finished);
2496
2480
 
2497
- --_dispatchCount;
2481
+ if (isTwoWay)
2482
+ {
2483
+ OutgoingMessage message(&response.outputStream(), compress > 0);
2484
+ sendMessage(message);
2485
+ }
2498
2486
 
2499
- if (_state == StateClosing && _upcallCount == 0)
2487
+ if (_state == StateActive && _maxDispatches > 0 && _dispatchCount == _maxDispatches)
2488
+ {
2489
+ // Resume reading if the connection is active and the dispatch count is about to be less than
2490
+ // _maxDispatches.
2491
+ _threadPool->update(shared_from_this(), SocketOperationNone, SocketOperationRead);
2492
+ if (_idleTimeoutTransceiver)
2500
2493
  {
2501
- initiateShutdown();
2494
+ _idleTimeoutTransceiver->enableIdleCheck();
2502
2495
  }
2503
2496
  }
2504
- catch (const LocalException&)
2497
+
2498
+ --_dispatchCount;
2499
+
2500
+ if (_state == StateClosing && _upcallCount == 0)
2505
2501
  {
2506
- setState(StateClosed, current_exception());
2502
+ initiateShutdown();
2507
2503
  }
2508
2504
  }
2509
2505
  catch (...)
2510
2506
  {
2511
- dispatchException(current_exception(), 1);
2507
+ setState(StateClosed, current_exception());
2512
2508
  }
2513
2509
  }
2514
2510
 
@@ -2717,7 +2713,7 @@ Ice::ConnectionI::sendNextMessages(vector<OutgoingMessage>& callbacks)
2717
2713
  _writeStream.swap(*message->stream);
2718
2714
  if (message->sent())
2719
2715
  {
2720
- callbacks.push_back(*message);
2716
+ callbacks.push_back(std::move(*message));
2721
2717
  }
2722
2718
  }
2723
2719
  _sendStreams.pop_front();
@@ -2850,7 +2846,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2850
2846
  // message was queued.
2851
2847
  if (!_sendStreams.empty())
2852
2848
  {
2853
- _sendStreams.push_back(message);
2849
+ _sendStreams.push_back(std::move(message));
2854
2850
  _sendStreams.back().adopt(nullptr);
2855
2851
  return AsyncStatusQueued;
2856
2852
  }
@@ -2895,7 +2891,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2895
2891
  return status;
2896
2892
  }
2897
2893
 
2898
- _sendStreams.push_back(message);
2894
+ _sendStreams.push_back(std::move(message));
2899
2895
  _sendStreams.back().adopt(&stream);
2900
2896
  }
2901
2897
  else
@@ -2945,7 +2941,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2945
2941
  return status;
2946
2942
  }
2947
2943
 
2948
- _sendStreams.push_back(message);
2944
+ _sendStreams.push_back(std::move(message));
2949
2945
  _sendStreams.back().adopt(nullptr); // Adopt the stream.
2950
2946
  #ifdef ICE_HAS_BZIP2
2951
2947
  }
@@ -3260,6 +3256,22 @@ Ice::ConnectionI::parseMessage(int32_t& upcallCount, function<bool(InputStream&)
3260
3256
  "received batch request with " + to_string(requestCount) + " batches"};
3261
3257
  }
3262
3258
 
3259
+ // A batched request occupies at least 12 bytes on the wire (a 2-byte identity, a
3260
+ // 1-byte facet path, a 1-byte operation name, a 1-byte operation mode, a 1-byte
3261
+ // context, and a 6-byte parameters encapsulation). Reject a count larger than the
3262
+ // remaining message data could possibly hold. The message size is already capped
3263
+ // at Ice.MessageSizeMax (<= INT32_MAX bytes), so this also keeps requestCount well
3264
+ // within range when it is accumulated into the dispatch counters below.
3265
+ constexpr int32_t minBatchRequestSize = 12;
3266
+ if (requestCount > (stream.b.end() - stream.i) / minBatchRequestSize)
3267
+ {
3268
+ throw MarshalException{
3269
+ __FILE__,
3270
+ __LINE__,
3271
+ "received batch request with " + to_string(requestCount) +
3272
+ " batches, more than the message can contain"};
3273
+ }
3274
+
3263
3275
  upcall = [self = shared_from_this(), requestCount, adapter, compress](InputStream& messageStream)
3264
3276
  {
3265
3277
  self->dispatchAll(messageStream, requestCount, requestId, compress, adapter);
@@ -3297,7 +3309,7 @@ Ice::ConnectionI::parseMessage(int32_t& upcallCount, function<bool(InputStream&)
3297
3309
 
3298
3310
  if (q != _asyncRequests.end())
3299
3311
  {
3300
- auto outAsync = q->second;
3312
+ auto outAsync = std::move(q->second);
3301
3313
 
3302
3314
  if (q == _asyncRequestsHint)
3303
3315
  {
@@ -3437,9 +3449,10 @@ Ice::ConnectionI::dispatchAll(
3437
3449
  {
3438
3450
  // Received request on a connection without an object adapter.
3439
3451
  sendResponse(
3440
- makeOutgoingResponse(
3452
+ makeOutgoingResponseCore(
3441
3453
  make_exception_ptr(ObjectNotExistException{__FILE__, __LINE__}),
3442
- request.current()),
3454
+ request.current(),
3455
+ _instance.get()),
3443
3456
  0);
3444
3457
  }
3445
3458
 
@@ -72,7 +72,7 @@ namespace Ice
72
72
  public:
73
73
  std::shared_ptr<ConnectionI> shared_from_this()
74
74
  {
75
- return std::dynamic_pointer_cast<ConnectionI>(IceInternal::EventHandler::shared_from_this());
75
+ return std::static_pointer_cast<ConnectionI>(IceInternal::EventHandler::shared_from_this());
76
76
  }
77
77
 
78
78
  struct OutgoingMessage
@@ -146,7 +146,6 @@ namespace Ice
146
146
  void close(std::function<void()> response, std::function<void(std::exception_ptr)> exception) noexcept final;
147
147
 
148
148
  [[nodiscard]] bool isActiveOrHolding() const;
149
- [[nodiscard]] bool isFinished() const;
150
149
 
151
150
  void throwException() const final; // From Connection. Throws the connection exception if destroyed.
152
151
 
@@ -209,8 +208,6 @@ namespace Ice
209
208
 
210
209
  void setBufferSize(std::int32_t rcvSize, std::int32_t sndSize) final; // From Connection
211
210
 
212
- void exception(std::exception_ptr);
213
-
214
211
  // This method is called to execute user code (connection start completion callback, invocation sent callbacks,
215
212
  // or an upcall issued from an incoming message). The invocation sent callbacks and the message upcall might
216
213
  // both be set.
@@ -221,7 +218,13 @@ namespace Ice
221
218
  InputStream& messageStream);
222
219
  void finish(bool);
223
220
 
224
- void closeCallback(const CloseCallback&);
221
+ // Executes a callback provided by the application, catching and logging any exception it throws.
222
+ void executeCallback(const CloseCallback& callback) noexcept;
223
+ void executeCallback(const std::function<void()>& callback) noexcept;
224
+
225
+ /// Gets the thread pool that services this connection: the client thread pool for an outgoing connection,
226
+ /// and the object adapter's thread pool for an incoming connection.
227
+ [[nodiscard]] const IceInternal::ThreadPoolPtr& getThreadPool() const noexcept { return _threadPool; }
225
228
 
226
229
  /// Aborts the connection with a ConnectionAbortedException if the connection is active and did not receive
227
230
  /// a byte for some time. See the IdleTimeoutTransceiverDecorator.
@@ -250,7 +253,7 @@ namespace Ice
250
253
  const IceInternal::EndpointIPtr&,
251
254
  const std::shared_ptr<ObjectAdapterI>&,
252
255
  std::function<void(const ConnectionIPtr&)>,
253
- const ConnectionOptions&) noexcept;
256
+ const ConnectionOptions&);
254
257
 
255
258
  static ConnectionIPtr create(
256
259
  const Ice::CommunicatorPtr&,
@@ -289,12 +292,12 @@ namespace Ice
289
292
  bool validate(IceInternal::SocketOperation = IceInternal::SocketOperationNone);
290
293
 
291
294
  /// Sends the next queued messages. This method is called by message() once the message which is being sent
292
- /// (_sendStreams.First) is fully sent. Before sending the next message, this message is removed from
293
- /// _sendsStream. If any, its sent callback is also queued in given callback queue.
295
+ /// (_sendStreams.front()) is fully sent. Before sending the next message, this message is removed from
296
+ /// _sendStreams. If any, its sent callback is also queued in given callback queue.
294
297
  ///
295
298
  /// @param callbacks The sent callbacks to call for the messages that were sent.
296
299
  /// @return The socket operation to register with the thread pool's selector to send the remainder of the
297
- /// pending message being sent (_sendStreams.First).
300
+ /// pending message being sent (_sendStreams.front()).
298
301
  IceInternal::SocketOperation sendNextMessages(std::vector<OutgoingMessage>& callbacks);
299
302
 
300
303
  /// Sends or queues the given message.
@@ -16,7 +16,7 @@ using namespace std;
16
16
  namespace
17
17
  {
18
18
  mutex consoleMutex;
19
- // We leak consoleUtil object to ensure that is available during static destruction.
19
+ // We leak consoleUtil object to ensure that it is available during static destruction.
20
20
  ConsoleUtil* consoleUtil = 0;
21
21
  }
22
22
 
@@ -52,25 +52,21 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
52
52
  throw ParseException(__FILE__, __LINE__, "illegal value '" + value + "'; expected 'Random' or 'Ordered'");
53
53
  }
54
54
 
55
- const_cast<chrono::milliseconds&>(defaultInvocationTimeout) =
56
- chrono::milliseconds(properties->getIcePropertyAsInt("Ice.Default.InvocationTimeout"));
57
- if (defaultInvocationTimeout.count() < 1 && defaultInvocationTimeout.count() != -1)
55
+ auto invocationTimeout = chrono::milliseconds(properties->getIcePropertyAsInt("Ice.Default.InvocationTimeout"));
56
+ if (invocationTimeout <= chrono::milliseconds::zero())
58
57
  {
59
- throw InitializationException{
60
- __FILE__,
61
- __LINE__,
62
- "invalid value for Ice.Default.InvocationTimeout: " + to_string(defaultInvocationTimeout.count())};
58
+ // Zero or any negative timeout means infinite and is normalized to -1.
59
+ invocationTimeout = chrono::milliseconds(-1);
63
60
  }
61
+ const_cast<chrono::milliseconds&>(defaultInvocationTimeout) = invocationTimeout;
64
62
 
65
- const_cast<chrono::seconds&>(defaultLocatorCacheTimeout) =
66
- chrono::seconds(properties->getIcePropertyAsInt("Ice.Default.LocatorCacheTimeout"));
67
- if (defaultLocatorCacheTimeout.count() < -1)
63
+ auto locatorCacheTimeout = chrono::seconds(properties->getIcePropertyAsInt("Ice.Default.LocatorCacheTimeout"));
64
+ if (locatorCacheTimeout < chrono::seconds::zero())
68
65
  {
69
- throw InitializationException{
70
- __FILE__,
71
- __LINE__,
72
- "invalid value for Ice.Default.LocatorCacheTimeout: " + to_string(defaultLocatorCacheTimeout.count())};
66
+ // Any negative timeout means infinite and is normalized to -1; 0 means no caching.
67
+ locatorCacheTimeout = chrono::seconds(-1);
73
68
  }
69
+ const_cast<chrono::seconds&>(defaultLocatorCacheTimeout) = locatorCacheTimeout;
74
70
 
75
71
  value = properties->getIceProperty("Ice.Default.EncodingVersion");
76
72
  defaultEncoding = stringToEncodingVersion(value);
@@ -64,7 +64,7 @@ namespace IceInternal
64
64
  [[nodiscard]] virtual EndpointIPtr connectionId(const std::string&) const = 0;
65
65
 
66
66
  //
67
- // Return true if the endpoints support bzip2 compress, or false
67
+ // Return true if the endpoint supports bzip2 compression, or false
68
68
  // otherwise.
69
69
  //
70
70
  [[nodiscard]] virtual bool compress() const = 0;