zeroc-ice 3.6.5 → 3.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (777) hide show
  1. checksums.yaml +5 -5
  2. data/ICE_LICENSE +17 -17
  3. data/LICENSE +12 -12
  4. data/bin/slice2rb +1 -6
  5. data/ext/Communicator.cpp +223 -61
  6. data/ext/Communicator.h +1 -6
  7. data/ext/Config.h +23 -7
  8. data/ext/Connection.cpp +108 -76
  9. data/ext/Connection.h +4 -6
  10. data/ext/Endpoint.cpp +16 -54
  11. data/ext/Endpoint.h +1 -6
  12. data/ext/ImplicitContext.cpp +1 -10
  13. data/ext/ImplicitContext.h +1 -6
  14. data/ext/Init.cpp +4 -6
  15. data/ext/Logger.cpp +1 -6
  16. data/ext/Logger.h +1 -6
  17. data/ext/Operation.cpp +38 -54
  18. data/ext/Operation.h +1 -6
  19. data/ext/Properties.cpp +3 -8
  20. data/ext/Properties.h +1 -6
  21. data/ext/Proxy.cpp +111 -70
  22. data/ext/Proxy.h +1 -6
  23. data/ext/Slice.cpp +5 -20
  24. data/ext/Slice.h +1 -6
  25. data/ext/Types.cpp +313 -224
  26. data/ext/Types.h +118 -71
  27. data/ext/Util.cpp +69 -36
  28. data/ext/Util.h +117 -42
  29. data/ext/ValueFactoryManager.cpp +440 -0
  30. data/ext/ValueFactoryManager.h +95 -0
  31. data/ext/extconf.rb +52 -48
  32. data/ext/ice/cpp/include/Ice/Application.h +275 -105
  33. data/ext/ice/cpp/include/Ice/AsyncResult.h +124 -337
  34. data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -7
  35. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +39 -16
  36. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -6
  37. data/ext/ice/cpp/include/Ice/Buffer.h +10 -15
  38. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +56 -17
  39. data/ext/ice/cpp/include/Ice/Comparable.h +205 -0
  40. data/ext/ice/cpp/include/Ice/Config.h +16 -39
  41. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +203 -16
  42. data/ext/ice/cpp/include/Ice/ConnectionIF.h +7 -6
  43. data/ext/ice/cpp/include/Ice/ConsoleUtil.h +23 -0
  44. data/ext/ice/cpp/include/Ice/DefaultValueFactory.h +57 -0
  45. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +20 -12
  46. data/ext/ice/cpp/include/Ice/Dispatcher.h +35 -19
  47. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -10
  48. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -6
  49. data/ext/ice/cpp/include/Ice/Exception.h +110 -63
  50. data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +74 -0
  51. data/ext/ice/cpp/include/Ice/FactoryTable.h +22 -18
  52. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +28 -31
  53. data/ext/ice/cpp/include/Ice/Format.h +17 -18
  54. data/ext/ice/cpp/include/Ice/Functional.h +38 -38
  55. data/ext/ice/cpp/include/Ice/GCObject.h +9 -10
  56. data/ext/ice/cpp/include/Ice/Handle.h +6 -16
  57. data/ext/ice/cpp/include/Ice/Ice.h +9 -10
  58. data/ext/ice/cpp/include/Ice/IconvStringConverter.h +377 -0
  59. data/ext/ice/cpp/include/Ice/Incoming.h +132 -38
  60. data/ext/ice/cpp/include/Ice/IncomingAsync.h +109 -31
  61. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -6
  62. data/ext/ice/cpp/include/Ice/Initialize.h +872 -60
  63. data/ext/ice/cpp/include/Ice/InputStream.h +1514 -0
  64. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -7
  65. data/ext/ice/cpp/include/Ice/InterfaceByValue.h +57 -0
  66. data/ext/ice/cpp/include/Ice/LocalObject.h +13 -14
  67. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -6
  68. data/ext/ice/cpp/include/Ice/LoggerUtil.h +56 -24
  69. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +124 -71
  70. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +25 -10
  71. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +116 -32
  72. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +61 -30
  73. data/ext/ice/cpp/include/Ice/Object.h +413 -78
  74. data/ext/ice/cpp/include/Ice/ObjectF.h +12 -8
  75. data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -13
  76. data/ext/ice/cpp/include/Ice/Optional.h +1114 -0
  77. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +684 -89
  78. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -11
  79. data/ext/ice/cpp/include/Ice/OutputStream.h +1092 -0
  80. data/ext/ice/cpp/include/Ice/Protocol.h +49 -17
  81. data/ext/ice/cpp/include/Ice/Proxy.h +3438 -745
  82. data/ext/ice/cpp/include/Ice/ProxyF.h +13 -38
  83. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -6
  84. data/ext/ice/cpp/include/Ice/ProxyHandle.h +43 -55
  85. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -6
  86. data/ext/ice/cpp/include/Ice/RegisterPlugins.h +84 -12
  87. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -9
  88. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -6
  89. data/ext/ice/cpp/include/Ice/SHA1.h +42 -0
  90. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -6
  91. data/ext/ice/cpp/include/Ice/Service.h +273 -154
  92. data/ext/ice/cpp/include/Ice/SliceChecksums.h +5 -6
  93. data/ext/ice/cpp/include/Ice/SlicedData.h +121 -53
  94. data/ext/ice/cpp/include/Ice/SlicedDataF.h +17 -11
  95. data/ext/ice/cpp/include/Ice/StreamHelpers.h +453 -140
  96. data/ext/ice/cpp/include/Ice/StringConverter.h +78 -0
  97. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -6
  98. data/ext/ice/cpp/include/Ice/UUID.h +19 -0
  99. data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +22 -28
  100. data/ext/ice/cpp/include/Ice/UniqueRef.h +97 -0
  101. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +45 -13
  102. data/ext/ice/cpp/include/Ice/Value.h +139 -0
  103. data/ext/ice/cpp/include/Ice/ValueF.h +21 -0
  104. data/ext/ice/cpp/include/IceSSL/Config.h +8 -28
  105. data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -11
  106. data/ext/ice/cpp/include/IceSSL/OpenSSL.h +147 -0
  107. data/ext/ice/cpp/include/IceSSL/Plugin.h +461 -448
  108. data/ext/ice/cpp/include/IceSSL/SChannel.h +72 -0
  109. data/ext/ice/cpp/include/IceSSL/SecureTransport.h +72 -0
  110. data/ext/ice/cpp/include/IceSSL/UWP.h +62 -0
  111. data/ext/ice/cpp/include/IceUtil/Atomic.h +7 -14
  112. data/ext/ice/cpp/include/IceUtil/Cond.h +17 -23
  113. data/ext/ice/cpp/include/IceUtil/Config.h +166 -46
  114. data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +92 -0
  115. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -10
  116. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +63 -41
  117. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +5 -13
  118. data/ext/ice/cpp/include/IceUtil/Exception.h +284 -75
  119. data/ext/ice/cpp/include/IceUtil/FileUtil.h +143 -0
  120. data/ext/ice/cpp/include/IceUtil/Functional.h +4 -6
  121. data/ext/ice/cpp/include/IceUtil/Handle.h +11 -16
  122. data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -15
  123. data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -8
  124. data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -7
  125. data/ext/ice/cpp/include/IceUtil/Lock.h +8 -15
  126. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -7
  127. data/ext/ice/cpp/include/IceUtil/Mutex.h +19 -23
  128. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -7
  129. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -9
  130. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -9
  131. data/ext/ice/cpp/include/IceUtil/Optional.h +134 -23
  132. data/ext/ice/cpp/include/IceUtil/Options.h +17 -23
  133. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +61 -37
  134. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -11
  135. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +18 -15
  136. data/ext/ice/cpp/include/IceUtil/Random.h +39 -8
  137. data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -13
  138. data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +53 -0
  139. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +10 -15
  140. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -7
  141. data/ext/ice/cpp/include/IceUtil/Shared.h +5 -12
  142. data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -7
  143. data/ext/ice/cpp/include/IceUtil/StringConverter.h +146 -126
  144. data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -26
  145. data/ext/ice/cpp/include/IceUtil/Thread.h +10 -17
  146. data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -47
  147. data/ext/ice/cpp/include/IceUtil/Time.h +3 -8
  148. data/ext/ice/cpp/include/IceUtil/Timer.h +18 -18
  149. data/ext/ice/cpp/include/IceUtil/UUID.h +6 -7
  150. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -6
  151. data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +170 -0
  152. data/ext/ice/cpp/include/generated/Ice/Communicator.h +1156 -0
  153. data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +51 -16
  154. data/ext/ice/cpp/include/generated/Ice/Connection.h +1660 -0
  155. data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +119 -0
  156. data/ext/ice/cpp/include/generated/Ice/Current.h +322 -0
  157. data/ext/ice/cpp/include/generated/Ice/Endpoint.h +943 -0
  158. data/ext/ice/cpp/include/generated/Ice/EndpointF.h +166 -0
  159. data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +118 -0
  160. data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +31 -15
  161. data/ext/ice/cpp/include/generated/Ice/Identity.h +264 -0
  162. data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +278 -0
  163. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +51 -16
  164. data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +1143 -0
  165. data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +128 -0
  166. data/ext/ice/cpp/include/generated/Ice/LocalException.h +7041 -0
  167. data/ext/ice/cpp/include/generated/Ice/Locator.h +3850 -0
  168. data/ext/ice/cpp/include/generated/Ice/LocatorF.h +147 -0
  169. data/ext/ice/cpp/include/generated/Ice/Logger.h +231 -0
  170. data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +51 -16
  171. data/ext/ice/cpp/include/generated/Ice/Metrics.h +4717 -0
  172. data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +1175 -0
  173. data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +51 -16
  174. data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +197 -0
  175. data/ext/ice/cpp/include/generated/Ice/Plugin.h +306 -0
  176. data/ext/ice/cpp/include/generated/Ice/PluginF.h +110 -0
  177. data/ext/ice/cpp/include/generated/Ice/Process.h +971 -0
  178. data/ext/ice/cpp/include/generated/Ice/ProcessF.h +125 -0
  179. data/ext/ice/cpp/include/generated/Ice/Properties.h +446 -0
  180. data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +1360 -0
  181. data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +134 -0
  182. data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +2689 -0
  183. data/ext/ice/cpp/include/generated/Ice/Router.h +1838 -0
  184. data/ext/ice/cpp/include/generated/Ice/RouterF.h +125 -0
  185. data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +299 -0
  186. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +51 -16
  187. data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +34 -14
  188. data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +318 -0
  189. data/ext/ice/cpp/include/generated/Ice/Version.h +357 -0
  190. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +223 -0
  191. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +101 -0
  192. data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +181 -0
  193. data/ext/ice/cpp/src/Ice/ACM.cpp +38 -27
  194. data/ext/ice/cpp/src/Ice/ACM.h +9 -7
  195. data/ext/ice/cpp/src/Ice/ACMF.h +30 -0
  196. data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -6
  197. data/ext/ice/cpp/src/Ice/Acceptor.h +4 -8
  198. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -6
  199. data/ext/ice/cpp/src/Ice/ArgVector.cpp +59 -0
  200. data/ext/ice/cpp/src/Ice/ArgVector.h +36 -0
  201. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -544
  202. data/ext/ice/cpp/src/Ice/Base64.cpp +22 -28
  203. data/ext/ice/cpp/src/Ice/Base64.h +1 -6
  204. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +41 -18
  205. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -15
  206. data/ext/ice/cpp/src/Ice/Buffer.cpp +75 -18
  207. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +21 -12
  208. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +86 -197
  209. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -23
  210. data/ext/ice/cpp/src/Ice/Communicator.cpp +43 -15
  211. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +28 -11
  212. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +318 -117
  213. data/ext/ice/cpp/src/Ice/CommunicatorI.h +95 -40
  214. data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -8
  215. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +55 -122
  216. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +15 -31
  217. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -7
  218. data/ext/ice/cpp/src/Ice/Connection.cpp +111 -20
  219. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +28 -11
  220. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +300 -107
  221. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +44 -28
  222. data/ext/ice/cpp/src/Ice/ConnectionFactoryF.h +30 -0
  223. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +785 -713
  224. data/ext/ice/cpp/src/Ice/ConnectionI.h +105 -80
  225. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -20
  226. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +5 -9
  227. data/ext/ice/cpp/src/Ice/Connector.cpp +6 -6
  228. data/ext/ice/cpp/src/Ice/Connector.h +4 -8
  229. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -6
  230. data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -9
  231. data/ext/ice/cpp/src/Ice/Current.cpp +30 -12
  232. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -16
  233. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -6
  234. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -6
  235. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +13 -25
  236. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +34 -28
  237. data/ext/ice/cpp/src/Ice/Endpoint.cpp +107 -19
  238. data/ext/ice/cpp/src/Ice/EndpointF.cpp +28 -11
  239. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -6
  240. data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -11
  241. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -6
  242. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +41 -36
  243. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -9
  244. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -6
  245. data/ext/ice/cpp/src/Ice/EndpointI.cpp +18 -7
  246. data/ext/ice/cpp/src/Ice/EndpointI.h +39 -18
  247. data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -10
  248. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +19 -12
  249. data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -9
  250. data/ext/ice/cpp/src/Ice/EventHandler.h +13 -13
  251. data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -7
  252. data/ext/ice/cpp/src/Ice/Exception.cpp +102 -98
  253. data/ext/ice/cpp/src/Ice/FacetMap.cpp +21 -12
  254. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -33
  255. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -9
  256. data/ext/ice/cpp/src/Ice/GCObject.cpp +29 -31
  257. data/ext/ice/cpp/src/Ice/HashUtil.h +3 -9
  258. data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -7
  259. data/ext/ice/cpp/src/Ice/HttpParser.h +1 -6
  260. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +128 -111
  261. data/ext/ice/cpp/src/Ice/IPEndpointI.h +23 -19
  262. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -7
  263. data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +51 -0
  264. data/ext/ice/cpp/src/Ice/Identity.cpp +25 -16
  265. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -13
  266. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +28 -11
  267. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +11 -28
  268. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -10
  269. data/ext/ice/cpp/src/Ice/Incoming.cpp +284 -255
  270. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -214
  271. data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -9
  272. data/ext/ice/cpp/src/Ice/Initialize.cpp +309 -193
  273. data/ext/ice/cpp/src/Ice/InputStream.cpp +2726 -0
  274. data/ext/ice/cpp/src/Ice/Instance.cpp +243 -262
  275. data/ext/ice/cpp/src/Ice/Instance.h +30 -23
  276. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +137 -23
  277. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +28 -11
  278. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +118 -105
  279. data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -36
  280. data/ext/ice/cpp/src/Ice/LocalException.cpp +1191 -422
  281. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -7
  282. data/ext/ice/cpp/src/Ice/Locator.cpp +1282 -1222
  283. data/ext/ice/cpp/src/Ice/LocatorF.cpp +30 -12
  284. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +150 -186
  285. data/ext/ice/cpp/src/Ice/LocatorInfo.h +31 -36
  286. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -6
  287. data/ext/ice/cpp/src/Ice/Logger.cpp +39 -12
  288. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +182 -88
  289. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -9
  290. data/ext/ice/cpp/src/Ice/LoggerF.cpp +28 -11
  291. data/ext/ice/cpp/src/Ice/LoggerI.cpp +26 -55
  292. data/ext/ice/cpp/src/Ice/LoggerI.h +7 -18
  293. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -17
  294. data/ext/ice/cpp/src/Ice/Metrics.cpp +1280 -1107
  295. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +58 -33
  296. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -7
  297. data/ext/ice/cpp/src/Ice/Network.cpp +753 -408
  298. data/ext/ice/cpp/src/Ice/Network.h +99 -36
  299. data/ext/ice/cpp/src/Ice/NetworkF.h +2 -7
  300. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +20 -19
  301. data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -7
  302. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -6
  303. data/ext/ice/cpp/src/Ice/OSLogLoggerI.cpp +57 -0
  304. data/ext/ice/cpp/src/Ice/OSLogLoggerI.h +40 -0
  305. data/ext/ice/cpp/src/Ice/Object.cpp +227 -232
  306. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +45 -13
  307. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +28 -11
  308. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +83 -33
  309. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -12
  310. data/ext/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +25 -0
  311. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +298 -191
  312. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +44 -39
  313. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -13
  314. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -37
  315. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +67 -67
  316. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +15 -11
  317. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +801 -366
  318. data/ext/ice/cpp/src/Ice/OutputStream.cpp +1367 -0
  319. data/ext/ice/cpp/src/Ice/Plugin.cpp +52 -14
  320. data/ext/ice/cpp/src/Ice/PluginF.cpp +28 -11
  321. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +27 -51
  322. data/ext/ice/cpp/src/Ice/PluginManagerI.h +7 -13
  323. data/ext/ice/cpp/src/Ice/Process.cpp +294 -128
  324. data/ext/ice/cpp/src/Ice/ProcessF.cpp +30 -12
  325. data/ext/ice/cpp/src/Ice/Properties.cpp +42 -15
  326. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +382 -340
  327. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +83 -24
  328. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -10
  329. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +30 -12
  330. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +46 -57
  331. data/ext/ice/cpp/src/Ice/PropertiesI.h +18 -26
  332. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +112 -19
  333. data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -7
  334. data/ext/ice/cpp/src/Ice/Protocol.cpp +6 -19
  335. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -7
  336. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -25
  337. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -6
  338. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -6
  339. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -6
  340. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -6
  341. data/ext/ice/cpp/src/Ice/Proxy.cpp +729 -957
  342. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +33 -38
  343. data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -16
  344. data/ext/ice/cpp/src/Ice/Reference.cpp +190 -106
  345. data/ext/ice/cpp/src/Ice/Reference.h +39 -28
  346. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +69 -118
  347. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -17
  348. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -6
  349. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +19 -9
  350. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -6
  351. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +766 -565
  352. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -6
  353. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -8
  354. data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -18
  355. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -11
  356. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -7
  357. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -11
  358. data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -12
  359. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +12 -20
  360. data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -11
  361. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -6
  362. data/ext/ice/cpp/src/Ice/Router.cpp +614 -492
  363. data/ext/ice/cpp/src/Ice/RouterF.cpp +30 -12
  364. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +93 -99
  365. data/ext/ice/cpp/src/Ice/RouterInfo.h +42 -38
  366. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -6
  367. data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +23 -28
  368. data/ext/ice/cpp/src/Ice/Selector.cpp +948 -855
  369. data/ext/ice/cpp/src/Ice/Selector.h +100 -152
  370. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -13
  371. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +28 -11
  372. data/ext/ice/cpp/src/Ice/ServantManager.cpp +24 -45
  373. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -6
  374. data/ext/ice/cpp/src/Ice/SharedContext.h +2 -7
  375. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +21 -12
  376. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -7
  377. data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -25
  378. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +208 -76
  379. data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -9
  380. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +57 -22
  381. data/ext/ice/cpp/src/Ice/StringUtil.h +30 -0
  382. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +6 -7
  383. data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -8
  384. data/ext/ice/cpp/src/Ice/SystemdJournalI.cpp +66 -0
  385. data/ext/ice/cpp/src/Ice/SystemdJournalI.h +39 -0
  386. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +169 -49
  387. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -10
  388. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +6 -12
  389. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -7
  390. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +51 -46
  391. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +12 -14
  392. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +17 -32
  393. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -15
  394. data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +41 -54
  395. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +242 -274
  396. data/ext/ice/cpp/src/Ice/ThreadPool.h +46 -48
  397. data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +38 -26
  398. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -7
  399. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -6
  400. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -7
  401. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -36
  402. data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -11
  403. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -7
  404. data/ext/ice/cpp/src/Ice/Transceiver.h +8 -12
  405. data/ext/ice/cpp/src/Ice/TransceiverF.h +3 -8
  406. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +5 -13
  407. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -7
  408. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +118 -60
  409. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +13 -10
  410. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +177 -236
  411. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -22
  412. data/ext/ice/cpp/src/Ice/Value.cpp +76 -0
  413. data/ext/ice/cpp/src/Ice/ValueFactory.cpp +83 -0
  414. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +61 -0
  415. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +37 -0
  416. data/ext/ice/cpp/src/Ice/Version.cpp +25 -20
  417. data/ext/ice/cpp/src/Ice/VirtualShared.h +38 -0
  418. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -14
  419. data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -12
  420. data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -16
  421. data/ext/ice/cpp/src/Ice/WSConnector.h +3 -11
  422. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +188 -89
  423. data/ext/ice/cpp/src/Ice/WSEndpoint.h +22 -37
  424. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +65 -66
  425. data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -27
  426. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +596 -281
  427. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1383 -543
  428. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +89 -32
  429. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -28
  430. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -66
  431. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -41
  432. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -64
  433. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -8
  434. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +450 -172
  435. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +863 -406
  436. data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +47 -0
  437. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +636 -144
  438. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +20 -173
  439. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -22
  440. data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +279 -0
  441. data/ext/ice/cpp/src/IceSSL/CertificateI.h +64 -0
  442. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -17
  443. data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +61 -0
  444. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +15 -64
  445. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -18
  446. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +207 -204
  447. data/ext/ice/cpp/src/IceSSL/EndpointI.h +43 -40
  448. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +42 -16
  449. data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -11
  450. data/ext/ice/cpp/src/IceSSL/Instance.h +7 -12
  451. data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -12
  452. data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +583 -0
  453. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +134 -115
  454. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +59 -0
  455. data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +27 -0
  456. data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +127 -0
  457. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +477 -182
  458. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +32 -26
  459. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +286 -0
  460. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +58 -0
  461. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -46
  462. data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -23
  463. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -60
  464. data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -12
  465. data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +580 -0
  466. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +523 -74
  467. data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +123 -0
  468. data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +31 -0
  469. data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +73 -0
  470. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +187 -221
  471. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +24 -26
  472. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +97 -94
  473. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +26 -192
  474. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -24
  475. data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +868 -0
  476. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +69 -201
  477. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +59 -0
  478. data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +29 -0
  479. data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +75 -0
  480. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +174 -161
  481. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +29 -33
  482. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +864 -0
  483. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +45 -0
  484. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +12 -22
  485. data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -9
  486. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -8
  487. data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +266 -0
  488. data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +338 -0
  489. data/ext/ice/cpp/src/IceSSL/UWPEngine.h +41 -0
  490. data/ext/ice/cpp/src/IceSSL/UWPEngineF.h +26 -0
  491. data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +89 -0
  492. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +383 -0
  493. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +71 -0
  494. data/ext/ice/cpp/src/IceSSL/Util.cpp +71 -1260
  495. data/ext/ice/cpp/src/IceSSL/Util.h +48 -142
  496. data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +157 -0
  497. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -27
  498. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -31
  499. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +22 -36
  500. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +30 -126
  501. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -6
  502. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -6
  503. data/ext/ice/cpp/src/IceUtil/Options.cpp +20 -33
  504. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +47 -21
  505. data/ext/ice/cpp/src/IceUtil/Random.cpp +15 -20
  506. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +4 -19
  507. data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -8
  508. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -269
  509. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +582 -244
  510. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -79
  511. data/ext/ice/cpp/src/IceUtil/Time.cpp +6 -11
  512. data/ext/ice/cpp/src/IceUtil/UUID.cpp +17 -22
  513. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +97 -101
  514. data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -40
  515. data/ext/ice/cpp/src/IceUtil/UtilException.cpp +839 -0
  516. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +894 -234
  517. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +72 -0
  518. data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -7
  519. data/ext/ice/cpp/src/Slice/Checksum.h +21 -0
  520. data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -83
  521. data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -14
  522. data/ext/ice/cpp/src/Slice/Grammar.cpp +1981 -1944
  523. data/ext/ice/cpp/src/Slice/Grammar.h +39 -19
  524. data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -20
  525. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2752 -1948
  526. data/ext/ice/cpp/src/Slice/JavaUtil.h +398 -0
  527. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -6
  528. data/ext/ice/cpp/src/Slice/MD5.h +1 -6
  529. data/ext/ice/cpp/src/Slice/MD5I.cpp +8 -1
  530. data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
  531. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +17 -20
  532. data/ext/ice/cpp/src/Slice/PHPUtil.h +36 -0
  533. data/ext/ice/cpp/src/Slice/Parser.cpp +1190 -426
  534. data/ext/ice/cpp/{include → src}/Slice/Parser.h +143 -91
  535. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +67 -36
  536. data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +8 -18
  537. data/ext/ice/cpp/src/Slice/Python.cpp +218 -111
  538. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +787 -699
  539. data/ext/ice/cpp/src/Slice/PythonUtil.h +70 -0
  540. data/ext/ice/cpp/src/Slice/Ruby.cpp +42 -43
  541. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +175 -445
  542. data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -11
  543. data/ext/ice/cpp/src/Slice/Scanner.cpp +390 -399
  544. data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +36 -69
  545. data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +456 -0
  546. data/ext/ice/cpp/src/Slice/Util.h +50 -0
  547. data/ice.gemspec +2 -9
  548. data/lib/Glacier2.rb +1 -6
  549. data/lib/Glacier2/Metrics.rb +6 -50
  550. data/lib/Glacier2/PermissionsVerifier.rb +23 -99
  551. data/lib/Glacier2/PermissionsVerifierF.rb +2 -7
  552. data/lib/Glacier2/Router.rb +31 -78
  553. data/lib/Glacier2/RouterF.rb +2 -7
  554. data/lib/Glacier2/SSLInfo.rb +3 -11
  555. data/lib/Glacier2/Session.rb +87 -311
  556. data/lib/Ice.rb +84 -58
  557. data/lib/Ice/BuiltinSequences.rb +3 -8
  558. data/lib/Ice/Communicator.rb +54 -61
  559. data/lib/Ice/CommunicatorF.rb +2 -7
  560. data/lib/Ice/Connection.rb +152 -166
  561. data/lib/Ice/ConnectionF.rb +2 -7
  562. data/lib/Ice/Current.rb +3 -15
  563. data/lib/Ice/Endpoint.rb +56 -137
  564. data/lib/Ice/EndpointF.rb +2 -7
  565. data/lib/Ice/EndpointTypes.rb +2 -11
  566. data/lib/Ice/FacetMap.rb +3 -8
  567. data/lib/Ice/Identity.rb +4 -12
  568. data/lib/Ice/ImplicitContext.rb +4 -38
  569. data/lib/Ice/ImplicitContextF.rb +2 -7
  570. data/lib/Ice/Instrumentation.rb +22 -279
  571. data/lib/Ice/InstrumentationF.rb +2 -7
  572. data/lib/Ice/LocalException.rb +94 -145
  573. data/lib/Ice/Locator.rb +50 -169
  574. data/lib/Ice/LocatorF.rb +2 -7
  575. data/lib/Ice/Logger.rb +4 -38
  576. data/lib/Ice/LoggerF.rb +2 -7
  577. data/lib/Ice/Metrics.rb +60 -420
  578. data/lib/Ice/ObjectAdapter.rb +29 -0
  579. data/lib/Ice/ObjectAdapterF.rb +2 -7
  580. data/lib/Ice/ObjectFactory.rb +4 -34
  581. data/lib/Ice/Plugin.rb +6 -64
  582. data/lib/Ice/PluginF.rb +2 -7
  583. data/lib/Ice/Process.rb +15 -56
  584. data/lib/Ice/ProcessF.rb +2 -7
  585. data/lib/Ice/Properties.rb +4 -45
  586. data/lib/Ice/PropertiesAdmin.rb +18 -60
  587. data/lib/Ice/PropertiesF.rb +2 -7
  588. data/lib/Ice/RemoteLogger.rb +33 -119
  589. data/lib/Ice/Router.rb +28 -105
  590. data/lib/Ice/RouterF.rb +2 -7
  591. data/lib/Ice/ServantLocator.rb +26 -0
  592. data/lib/Ice/ServantLocatorF.rb +24 -0
  593. data/lib/Ice/SliceChecksumDict.rb +2 -7
  594. data/lib/Ice/ValueFactory.rb +28 -0
  595. data/lib/Ice/Version.rb +4 -15
  596. data/lib/IceBox.rb +1 -6
  597. data/lib/IceBox/IceBox.rb +43 -152
  598. data/lib/IceGrid.rb +1 -9
  599. data/lib/IceGrid/Admin.rb +550 -431
  600. data/lib/IceGrid/Descriptor.rb +61 -533
  601. data/lib/IceGrid/Exception.rb +23 -49
  602. data/lib/IceGrid/FileParser.rb +13 -54
  603. data/lib/IceGrid/PluginFacade.rb +35 -0
  604. data/lib/IceGrid/Registry.rb +150 -62
  605. data/lib/IceGrid/Session.rb +24 -68
  606. data/lib/IceGrid/UserAccountMapper.rb +13 -54
  607. data/lib/IcePatch2.rb +1 -6
  608. data/lib/IcePatch2/FileInfo.rb +4 -15
  609. data/lib/IcePatch2/FileServer.rb +32 -80
  610. data/lib/IceStorm.rb +1 -6
  611. data/lib/IceStorm/IceStorm.rb +78 -210
  612. data/lib/IceStorm/Metrics.rb +10 -93
  613. data/slice/Glacier2/Metrics.ice +20 -10
  614. data/slice/Glacier2/PermissionsVerifier.ice +19 -12
  615. data/slice/Glacier2/PermissionsVerifierF.ice +16 -9
  616. data/slice/Glacier2/Router.ice +19 -13
  617. data/slice/Glacier2/RouterF.ice +16 -9
  618. data/slice/Glacier2/SSLInfo.ice +17 -10
  619. data/slice/Glacier2/Session.ice +24 -18
  620. data/slice/Ice/BuiltinSequences.ice +18 -9
  621. data/slice/Ice/Communicator.ice +180 -64
  622. data/slice/Ice/CommunicatorF.ice +18 -9
  623. data/slice/Ice/Connection.ice +208 -75
  624. data/slice/Ice/ConnectionF.ice +18 -9
  625. data/slice/Ice/Current.ice +37 -28
  626. data/slice/Ice/Endpoint.ice +73 -21
  627. data/slice/Ice/EndpointF.ice +19 -10
  628. data/slice/Ice/EndpointTypes.ice +21 -13
  629. data/slice/Ice/FacetMap.ice +19 -10
  630. data/slice/Ice/Identity.ice +24 -10
  631. data/slice/Ice/ImplicitContext.ice +41 -33
  632. data/slice/Ice/ImplicitContextF.ice +17 -9
  633. data/slice/Ice/Instrumentation.ice +37 -30
  634. data/slice/Ice/InstrumentationF.ice +19 -10
  635. data/slice/Ice/LocalException.ice +118 -112
  636. data/slice/Ice/Locator.ice +28 -21
  637. data/slice/Ice/LocatorF.ice +18 -9
  638. data/slice/Ice/Logger.ice +26 -18
  639. data/slice/Ice/LoggerF.ice +18 -9
  640. data/slice/Ice/Metrics.ice +42 -30
  641. data/slice/Ice/ObjectAdapter.ice +88 -53
  642. data/slice/Ice/ObjectAdapterF.ice +18 -9
  643. data/slice/Ice/ObjectFactory.ice +28 -17
  644. data/slice/Ice/Plugin.ice +25 -13
  645. data/slice/Ice/PluginF.ice +22 -9
  646. data/slice/Ice/Process.ice +20 -11
  647. data/slice/Ice/ProcessF.ice +18 -9
  648. data/slice/Ice/Properties.ice +42 -28
  649. data/slice/Ice/PropertiesAdmin.ice +20 -10
  650. data/slice/Ice/PropertiesF.ice +18 -9
  651. data/slice/Ice/RemoteLogger.ice +23 -19
  652. data/slice/Ice/Router.ice +28 -13
  653. data/slice/Ice/RouterF.ice +18 -9
  654. data/slice/Ice/ServantLocator.ice +40 -29
  655. data/slice/Ice/ServantLocatorF.ice +18 -9
  656. data/slice/Ice/SliceChecksumDict.ice +18 -9
  657. data/slice/Ice/ValueFactory.ice +132 -0
  658. data/slice/Ice/Version.ice +20 -10
  659. data/slice/IceBT/ConnectionInfo.ice +58 -0
  660. data/slice/IceBT/EndpointInfo.ice +56 -0
  661. data/slice/IceBT/Types.ice +44 -0
  662. data/slice/IceBox/IceBox.ice +45 -27
  663. data/slice/IceDiscovery/IceDiscovery.ice +75 -10
  664. data/slice/IceGrid/Admin.ice +410 -44
  665. data/slice/IceGrid/Descriptor.ice +47 -34
  666. data/slice/IceGrid/Exception.ice +43 -32
  667. data/slice/IceGrid/FileParser.ice +21 -12
  668. data/slice/IceGrid/PluginFacade.ice +26 -18
  669. data/slice/IceGrid/Registry.ice +150 -21
  670. data/slice/IceGrid/Session.ice +25 -17
  671. data/slice/IceGrid/UserAccountMapper.ice +23 -14
  672. data/slice/IceIAP/ConnectionInfo.ice +73 -0
  673. data/slice/IceIAP/EndpointInfo.ice +67 -0
  674. data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +19 -12
  675. data/slice/IcePatch2/FileInfo.ice +19 -13
  676. data/slice/IcePatch2/FileServer.ice +27 -18
  677. data/slice/IceSSL/ConnectionInfo.ice +27 -23
  678. data/slice/IceSSL/ConnectionInfoF.ice +30 -0
  679. data/slice/IceSSL/EndpointInfo.ice +21 -36
  680. data/slice/IceStorm/IceStorm.ice +33 -24
  681. data/slice/IceStorm/Metrics.ice +19 -11
  682. metadata +148 -120
  683. data/ext/ObjectFactory.cpp +0 -140
  684. data/ext/ObjectFactory.h +0 -50
  685. data/ext/ice/cpp/include/Ice/ACMF.h +0 -30
  686. data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
  687. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +0 -82
  688. data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
  689. data/ext/ice/cpp/include/Ice/Connection.h +0 -497
  690. data/ext/ice/cpp/include/Ice/ConnectionF.h +0 -74
  691. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +0 -30
  692. data/ext/ice/cpp/include/Ice/Current.h +0 -102
  693. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +0 -48
  694. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
  695. data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
  696. data/ext/ice/cpp/include/Ice/EndpointF.h +0 -93
  697. data/ext/ice/cpp/include/Ice/EndpointTypes.h +0 -82
  698. data/ext/ice/cpp/include/Ice/Identity.h +0 -168
  699. data/ext/ice/cpp/include/Ice/ImplicitContext.h +0 -102
  700. data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
  701. data/ext/ice/cpp/include/Ice/InstrumentationF.h +0 -75
  702. data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
  703. data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
  704. data/ext/ice/cpp/include/Ice/LocatorF.h +0 -93
  705. data/ext/ice/cpp/include/Ice/Logger.h +0 -100
  706. data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
  707. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
  708. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +0 -26
  709. data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
  710. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
  711. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +0 -26
  712. data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
  713. data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
  714. data/ext/ice/cpp/include/Ice/PluginF.h +0 -70
  715. data/ext/ice/cpp/include/Ice/Process.h +0 -574
  716. data/ext/ice/cpp/include/Ice/ProcessF.h +0 -83
  717. data/ext/ice/cpp/include/Ice/Properties.h +0 -136
  718. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
  719. data/ext/ice/cpp/include/Ice/PropertiesF.h +0 -87
  720. data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
  721. data/ext/ice/cpp/include/Ice/Router.h +0 -1159
  722. data/ext/ice/cpp/include/Ice/RouterF.h +0 -83
  723. data/ext/ice/cpp/include/Ice/ServantLocator.h +0 -96
  724. data/ext/ice/cpp/include/Ice/Stream.h +0 -447
  725. data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
  726. data/ext/ice/cpp/include/Ice/Version.h +0 -262
  727. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
  728. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
  729. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
  730. data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
  731. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +0 -302
  732. data/ext/ice/cpp/include/IceUtil/SHA1.h +0 -47
  733. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
  734. data/ext/ice/cpp/include/Slice/Checksum.h +0 -26
  735. data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
  736. data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
  737. data/ext/ice/cpp/include/Slice/JavaUtil.h +0 -279
  738. data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
  739. data/ext/ice/cpp/include/Slice/PHPUtil.h +0 -50
  740. data/ext/ice/cpp/include/Slice/PythonUtil.h +0 -64
  741. data/ext/ice/cpp/include/Slice/Util.h +0 -56
  742. data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
  743. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
  744. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +0 -44
  745. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
  746. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
  747. data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
  748. data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
  749. data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
  750. data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
  751. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
  752. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +0 -64
  753. data/ext/ice/cpp/src/IceUtil/ArgVector.h +0 -41
  754. data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
  755. data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
  756. data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
  757. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
  758. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
  759. data/lib/Ice/ObjectFactoryF.rb +0 -29
  760. data/lib/IceGrid/Locator.rb +0 -106
  761. data/lib/IceGrid/Observer.rb +0 -572
  762. data/lib/IceGrid/Query.rb +0 -169
  763. data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
  764. data/slice/Freeze/CatalogData.ice +0 -49
  765. data/slice/Freeze/Connection.ice +0 -121
  766. data/slice/Freeze/ConnectionF.ice +0 -20
  767. data/slice/Freeze/DB.ice +0 -37
  768. data/slice/Freeze/Evictor.ice +0 -346
  769. data/slice/Freeze/EvictorF.ice +0 -22
  770. data/slice/Freeze/EvictorStorage.ice +0 -72
  771. data/slice/Freeze/Exception.ice +0 -100
  772. data/slice/Freeze/Transaction.ice +0 -58
  773. data/slice/Freeze/TransactionalEvictor.ice +0 -50
  774. data/slice/Ice/ObjectFactoryF.ice +0 -21
  775. data/slice/IceGrid/Locator.ice +0 -57
  776. data/slice/IceGrid/Observer.ice +0 -395
  777. data/slice/IceGrid/Query.ice +0 -131
@@ -1,11 +1,6 @@
1
- // **********************************************************************
2
1
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
2
+ // Copyright (c) ZeroC, Inc. All rights reserved.
4
3
  //
5
- // This copy of Ice is licensed to you under the terms described in the
6
- // ICE_LICENSE file included in this distribution.
7
- //
8
- // **********************************************************************
9
4
 
10
5
  #ifndef ICE_CONNECTION_FACTORY_H
11
6
  #define ICE_CONNECTION_FACTORY_H
@@ -27,6 +22,7 @@
27
22
  #include <Ice/EndpointI.h>
28
23
  #include <Ice/InstrumentationF.h>
29
24
  #include <Ice/ACMF.h>
25
+ #include <Ice/Comparable.h>
30
26
 
31
27
  #include <list>
32
28
  #include <set>
@@ -36,18 +32,18 @@ namespace Ice
36
32
 
37
33
  class LocalException;
38
34
  class ObjectAdapterI;
39
- typedef IceUtil::Handle<ObjectAdapterI> ObjectAdapterIPtr;
35
+ ICE_DEFINE_PTR(ObjectAdapterIPtr, ObjectAdapterI);
40
36
 
41
37
  }
42
38
 
43
39
  namespace IceInternal
44
40
  {
45
41
 
46
- class OutgoingConnectionFactory : virtual public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
42
+ class OutgoingConnectionFactory : public virtual IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
47
43
  {
48
44
  public:
49
45
 
50
- class CreateConnectionCallback : virtual public IceUtil::Shared
46
+ class CreateConnectionCallback : public virtual IceUtil::Shared
51
47
  {
52
48
  public:
53
49
 
@@ -62,18 +58,17 @@ public:
62
58
 
63
59
  void waitUntilFinished();
64
60
 
65
- void create(const std::vector<EndpointIPtr>&, bool, Ice::EndpointSelectionType,
66
- const CreateConnectionCallbackPtr&);
61
+ void create(const std::vector<EndpointIPtr>&, bool, Ice::EndpointSelectionType, const CreateConnectionCallbackPtr&);
67
62
  void setRouterInfo(const RouterInfoPtr&);
68
63
  void removeAdapter(const Ice::ObjectAdapterPtr&);
69
- void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&);
70
-
71
- private:
64
+ void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&, Ice::CompressBatch);
72
65
 
73
66
  OutgoingConnectionFactory(const Ice::CommunicatorPtr&, const InstancePtr&);
74
67
  virtual ~OutgoingConnectionFactory();
75
68
  friend class Instance;
76
69
 
70
+ private:
71
+
77
72
  struct ConnectorInfo
78
73
  {
79
74
  ConnectorInfo(const ConnectorPtr& c, const EndpointIPtr& e) : connector(c), endpoint(e)
@@ -86,7 +81,12 @@ private:
86
81
  EndpointIPtr endpoint;
87
82
  };
88
83
 
89
- class ConnectCallback : public Ice::ConnectionI::StartCallback, public IceInternal::EndpointI_connectors
84
+ class ConnectCallback : public Ice::ConnectionI::StartCallback,
85
+ public IceInternal::EndpointI_connectors
86
+ #ifdef ICE_CPP11_MAPPING
87
+ , public std::enable_shared_from_this<ConnectCallback>
88
+ #endif
89
+
90
90
  {
91
91
  public:
92
92
 
@@ -129,7 +129,7 @@ private:
129
129
  std::vector<ConnectorInfo> _connectors;
130
130
  std::vector<ConnectorInfo>::const_iterator _iter;
131
131
  };
132
- typedef IceUtil::Handle<ConnectCallback> ConnectCallbackPtr;
132
+ ICE_DEFINE_PTR(ConnectCallbackPtr, ConnectCallback);
133
133
  friend class ConnectCallback;
134
134
 
135
135
  std::vector<EndpointIPtr> applyOverrides(const std::vector<EndpointIPtr>&);
@@ -158,7 +158,11 @@ private:
158
158
  std::multimap<ConnectorPtr, Ice::ConnectionIPtr> _connections;
159
159
  std::map<ConnectorPtr, std::set<ConnectCallbackPtr> > _pending;
160
160
 
161
+ #ifdef ICE_CPP11_MAPPING
162
+ std::multimap<EndpointIPtr, Ice::ConnectionIPtr, Ice::TargetCompare<EndpointIPtr, std::less>> _connectionsByEndpoint;
163
+ #else
161
164
  std::multimap<EndpointIPtr, Ice::ConnectionIPtr> _connectionsByEndpoint;
165
+ #endif
162
166
  int _pendingConnectCount;
163
167
  };
164
168
 
@@ -172,42 +176,53 @@ public:
172
176
  void hold();
173
177
  void destroy();
174
178
 
175
- #if TARGET_OS_IPHONE != 0
176
179
  void startAcceptor();
177
180
  void stopAcceptor();
178
- #endif
179
181
 
180
182
  void updateConnectionObservers();
181
183
 
182
184
  void waitUntilHolding() const;
183
185
  void waitUntilFinished();
184
186
 
187
+ bool isLocal(const EndpointIPtr&) const;
185
188
  EndpointIPtr endpoint() const;
186
189
  std::list<Ice::ConnectionIPtr> connections() const;
187
- void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&);
190
+ void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&, Ice::CompressBatch);
188
191
 
189
192
  //
190
193
  // Operations from EventHandler
191
194
  //
192
195
 
193
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
196
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
194
197
  virtual bool startAsync(SocketOperation);
195
198
  virtual bool finishAsync(SocketOperation);
196
199
  #endif
197
200
 
198
201
  virtual void message(ThreadPoolCurrent&);
199
202
  virtual void finished(ThreadPoolCurrent&, bool);
203
+ #if TARGET_OS_IPHONE != 0
204
+ void finish();
205
+ #endif
200
206
  virtual std::string toString() const;
201
207
  virtual NativeInfoPtr getNativeInfo();
202
208
 
203
209
  virtual void connectionStartCompleted(const Ice::ConnectionIPtr&);
204
210
  virtual void connectionStartFailed(const Ice::ConnectionIPtr&, const Ice::LocalException&);
205
211
 
206
- private:
207
-
208
- IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const Ice::ObjectAdapterIPtr&);
212
+ IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const EndpointIPtr&,
213
+ const Ice::ObjectAdapterIPtr&);
209
214
  void initialize();
210
215
  virtual ~IncomingConnectionFactory();
216
+
217
+ #ifdef ICE_CPP11_MAPPING
218
+ std::shared_ptr<IncomingConnectionFactory> shared_from_this()
219
+ {
220
+ return std::static_pointer_cast<IncomingConnectionFactory>(EventHandler::shared_from_this());
221
+ }
222
+ #endif
223
+
224
+ private:
225
+
211
226
  friend class Ice::ObjectAdapterI;
212
227
 
213
228
  enum State
@@ -229,18 +244,19 @@ private:
229
244
  AcceptorPtr _acceptor;
230
245
  const TransceiverPtr _transceiver;
231
246
  EndpointIPtr _endpoint;
247
+ EndpointIPtr _publishedEndpoint;
232
248
 
233
- #if TARGET_OS_IPHONE != 0
234
249
  bool _acceptorStarted;
235
- #endif
250
+ bool _acceptorStopped;
236
251
 
237
252
  Ice::ObjectAdapterIPtr _adapter;
238
-
239
253
  const bool _warn;
240
-
241
254
  std::set<Ice::ConnectionIPtr> _connections;
242
-
243
255
  State _state;
256
+
257
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
258
+ IceInternal::UniquePtr<Ice::LocalException> _acceptorException;
259
+ #endif
244
260
  };
245
261
 
246
262
  }
@@ -0,0 +1,30 @@
1
+ //
2
+ // Copyright (c) ZeroC, Inc. All rights reserved.
3
+ //
4
+
5
+ #ifndef ICE_CONNECTION_FACTORY_F_H
6
+ #define ICE_CONNECTION_FACTORY_F_H
7
+
8
+ #include <IceUtil/Shared.h>
9
+
10
+ #include <Ice/Handle.h>
11
+
12
+ namespace IceInternal
13
+ {
14
+
15
+ class OutgoingConnectionFactory;
16
+ IceUtil::Shared* upCast(OutgoingConnectionFactory*);
17
+ typedef IceInternal::Handle<OutgoingConnectionFactory> OutgoingConnectionFactoryPtr;
18
+
19
+ class IncomingConnectionFactory;
20
+
21
+ #ifdef ICE_CPP11_MAPPING
22
+ using IncomingConnectionFactoryPtr = ::std::shared_ptr<IncomingConnectionFactory>;
23
+ #else
24
+ IceUtil::Shared* upCast(IncomingConnectionFactory*);
25
+ typedef IceInternal::Handle<IncomingConnectionFactory> IncomingConnectionFactoryPtr;
26
+ #endif
27
+
28
+ }
29
+
30
+ #endif
@@ -1,11 +1,6 @@
1
- // **********************************************************************
2
1
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
2
+ // Copyright (c) ZeroC, Inc. All rights reserved.
4
3
  //
5
- // This copy of Ice is licensed to you under the terms described in the
6
- // ICE_LICENSE file included in this distribution.
7
- //
8
- // **********************************************************************
9
4
 
10
5
  #include <IceUtil/DisableWarnings.h>
11
6
  #include <Ice/ConnectionI.h>
@@ -20,7 +15,6 @@
20
15
  #include <Ice/ACM.h>
21
16
  #include <Ice/ObjectAdapterI.h> // For getThreadPool() and getServantManager().
22
17
  #include <Ice/EndpointI.h>
23
- #include <Ice/Outgoing.h>
24
18
  #include <Ice/OutgoingAsync.h>
25
19
  #include <Ice/Incoming.h>
26
20
  #include <Ice/LocalException.h>
@@ -38,13 +32,14 @@ using namespace Ice;
38
32
  using namespace Ice::Instrumentation;
39
33
  using namespace IceInternal;
40
34
 
35
+ #ifndef ICE_CPP11_MAPPING
41
36
  Ice::LocalObject* Ice::upCast(ConnectionI* p) { return p; }
37
+ #endif
42
38
 
43
39
  namespace
44
40
  {
45
41
 
46
- const ::std::string __flushBatchRequests_name = "flushBatchRequests";
47
-
42
+ const ::std::string flushBatchRequests_name = "flushBatchRequests";
48
43
 
49
44
  class TimeoutCallback : public IceUtil::TimerTask
50
45
  {
@@ -72,8 +67,8 @@ public:
72
67
  DispatchCall(const ConnectionIPtr& connection, const ConnectionI::StartCallbackPtr& startCB,
73
68
  const vector<ConnectionI::OutgoingMessage>& sentCBs, Byte compress, Int requestId,
74
69
  Int invokeNum, const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter,
75
- const OutgoingAsyncBasePtr& outAsync, const ConnectionCallbackPtr& heartbeatCallback,
76
- BasicStream& stream) :
70
+ const OutgoingAsyncBasePtr& outAsync, const ICE_DELEGATE(HeartbeatCallback)& heartbeatCallback,
71
+ InputStream& stream) :
77
72
  DispatchWorkItem(connection),
78
73
  _connection(connection),
79
74
  _startCB(startCB),
@@ -108,8 +103,8 @@ private:
108
103
  const ServantManagerPtr _servantManager;
109
104
  const ObjectAdapterPtr _adapter;
110
105
  const OutgoingAsyncBasePtr _outAsync;
111
- const ConnectionCallbackPtr _heartbeatCallback;
112
- BasicStream _stream;
106
+ const ICE_DELEGATE(HeartbeatCallback) _heartbeatCallback;
107
+ InputStream _stream;
113
108
  };
114
109
 
115
110
  class FinishCall : public DispatchWorkItem
@@ -133,19 +128,104 @@ private:
133
128
  const bool _close;
134
129
  };
135
130
 
131
+ //
132
+ // Class for handling Ice::Connection::begin_flushBatchRequests
133
+ //
134
+ class ConnectionFlushBatchAsync : public OutgoingAsyncBase
135
+ {
136
+ public:
137
+
138
+ ConnectionFlushBatchAsync(const Ice::ConnectionIPtr&, const InstancePtr&);
139
+
140
+ virtual Ice::ConnectionPtr getConnection() const;
141
+
142
+ void invoke(const std::string&, Ice::CompressBatch);
143
+
144
+ private:
145
+
146
+ const Ice::ConnectionIPtr _connection;
147
+ };
148
+ typedef IceUtil::Handle<ConnectionFlushBatchAsync> ConnectionFlushBatchAsyncPtr;
149
+
136
150
  ConnectionState connectionStateMap[] = {
137
- ConnectionStateValidating, // StateNotInitialized
138
- ConnectionStateValidating, // StateNotValidated
139
- ConnectionStateActive, // StateActive
140
- ConnectionStateHolding, // StateHolding
141
- ConnectionStateClosing, // StateClosing
142
- ConnectionStateClosing, // StateClosingPending
143
- ConnectionStateClosed, // StateClosed
144
- ConnectionStateClosed, // StateFinished
151
+ ICE_ENUM(ConnectionState, ConnectionStateValidating), // StateNotInitialized
152
+ ICE_ENUM(ConnectionState, ConnectionStateValidating), // StateNotValidated
153
+ ICE_ENUM(ConnectionState, ConnectionStateActive), // StateActive
154
+ ICE_ENUM(ConnectionState, ConnectionStateHolding), // StateHolding
155
+ ICE_ENUM(ConnectionState, ConnectionStateClosing), // StateClosing
156
+ ICE_ENUM(ConnectionState, ConnectionStateClosing), // StateClosingPending
157
+ ICE_ENUM(ConnectionState, ConnectionStateClosed), // StateClosed
158
+ ICE_ENUM(ConnectionState, ConnectionStateClosed), // StateFinished
145
159
  };
146
160
 
147
161
  }
148
162
 
163
+ ConnectionFlushBatchAsync::ConnectionFlushBatchAsync(const ConnectionIPtr& connection, const InstancePtr& instance) :
164
+ OutgoingAsyncBase(instance), _connection(connection)
165
+ {
166
+ }
167
+
168
+ ConnectionPtr
169
+ ConnectionFlushBatchAsync::getConnection() const
170
+ {
171
+ return _connection;
172
+ }
173
+
174
+ void
175
+ ConnectionFlushBatchAsync::invoke(const string& operation, Ice::CompressBatch compressBatch)
176
+ {
177
+ _observer.attach(_instance.get(), operation);
178
+ try
179
+ {
180
+ AsyncStatus status;
181
+ bool compress;
182
+ int batchRequestNum = _connection->getBatchRequestQueue()->swap(&_os, compress);
183
+ if(batchRequestNum == 0)
184
+ {
185
+ status = AsyncStatusSent;
186
+ if(sent())
187
+ {
188
+ status = static_cast<AsyncStatus>(status | AsyncStatusInvokeSentCallback);
189
+ }
190
+ }
191
+ else
192
+ {
193
+ if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, Yes))
194
+ {
195
+ compress = true;
196
+ }
197
+ else if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, No))
198
+ {
199
+ compress = false;
200
+ }
201
+ status = _connection->sendAsyncRequest(ICE_SHARED_FROM_THIS, compress, false, batchRequestNum);
202
+ }
203
+
204
+ if(status & AsyncStatusSent)
205
+ {
206
+ _sentSynchronously = true;
207
+ if(status & AsyncStatusInvokeSentCallback)
208
+ {
209
+ invokeSent();
210
+ }
211
+ }
212
+ }
213
+ catch(const RetryException& ex)
214
+ {
215
+ if(exception(*ex.get()))
216
+ {
217
+ invokeExceptionAsync();
218
+ }
219
+ }
220
+ catch(const Exception& ex)
221
+ {
222
+ if(exception(ex))
223
+ {
224
+ invokeExceptionAsync();
225
+ }
226
+ }
227
+ }
228
+
149
229
  Ice::ConnectionI::Observer::Observer() : _readStreamPos(0), _writeStreamPos(0)
150
230
  {
151
231
  }
@@ -209,9 +289,8 @@ Ice::ConnectionI::Observer::attach(const Ice::Instrumentation::ConnectionObserve
209
289
  }
210
290
  }
211
291
 
212
-
213
292
  void
214
- Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
293
+ Ice::ConnectionI::OutgoingMessage::adopt(OutputStream* str)
215
294
  {
216
295
  if(adopted)
217
296
  {
@@ -228,7 +307,7 @@ Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
228
307
  }
229
308
  else if(!str)
230
309
  {
231
- if(out || outAsync)
310
+ if(outAsync)
232
311
  {
233
312
  return; // Adopting request stream is not necessary.
234
313
  }
@@ -240,7 +319,7 @@ Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
240
319
  }
241
320
 
242
321
  assert(str);
243
- stream = new BasicStream(str->instance(), currentProtocolEncoding);
322
+ stream = new OutputStream(str->instance(), currentProtocolEncoding);
244
323
  stream->swap(*str);
245
324
  adopted = true;
246
325
  }
@@ -248,8 +327,7 @@ Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
248
327
  void
249
328
  Ice::ConnectionI::OutgoingMessage::canceled(bool adoptStream)
250
329
  {
251
- assert((out || outAsync)); // Only requests can timeout.
252
- out = 0;
330
+ assert(outAsync); // Only requests can timeout.
253
331
  outAsync = 0;
254
332
  if(adoptStream)
255
333
  {
@@ -270,13 +348,9 @@ Ice::ConnectionI::OutgoingMessage::sent()
270
348
  }
271
349
  stream = 0;
272
350
 
273
- if(out)
274
- {
275
- out->sent();
276
- }
277
- else if(outAsync)
351
+ if(outAsync)
278
352
  {
279
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
353
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
280
354
  invokeSent = outAsync->sent();
281
355
  return invokeSent || receivedReply;
282
356
  #else
@@ -289,15 +363,11 @@ Ice::ConnectionI::OutgoingMessage::sent()
289
363
  void
290
364
  Ice::ConnectionI::OutgoingMessage::completed(const Ice::LocalException& ex)
291
365
  {
292
- if(out)
293
- {
294
- out->completed(ex);
295
- }
296
- else if(outAsync)
366
+ if(outAsync)
297
367
  {
298
- if(outAsync->completed(ex))
368
+ if(outAsync->exception(ex))
299
369
  {
300
- outAsync->invokeCompleted();
370
+ outAsync->invokeException();
301
371
  }
302
372
  }
303
373
 
@@ -316,7 +386,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
316
386
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
317
387
  if(_state >= StateClosed) // The connection might already be closed if the communicator was destroyed.
318
388
  {
319
- assert(_exception.get());
389
+ assert(_exception);
320
390
  _exception->ice_throw();
321
391
  }
322
392
 
@@ -338,7 +408,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
338
408
 
339
409
  if(_state >= StateClosing)
340
410
  {
341
- assert(_exception.get());
411
+ assert(_exception);
342
412
  _exception->ice_throw();
343
413
  }
344
414
  }
@@ -353,7 +423,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
353
423
  exception(ex);
354
424
  if(callback)
355
425
  {
356
- callback->connectionStartFailed(this, *_exception.get());
426
+ callback->connectionStartFailed(ICE_SHARED_FROM_THIS, ex);
357
427
  return;
358
428
  }
359
429
  else
@@ -365,7 +435,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
365
435
 
366
436
  if(callback)
367
437
  {
368
- callback->connectionStartCompleted(this);
438
+ callback->connectionStartCompleted(ICE_SHARED_FROM_THIS);
369
439
  }
370
440
  }
371
441
 
@@ -418,29 +488,31 @@ Ice::ConnectionI::destroy(DestructionReason reason)
418
488
  }
419
489
 
420
490
  void
421
- Ice::ConnectionI::close(bool force)
491
+ Ice::ConnectionI::close(ConnectionClose mode) ICE_NOEXCEPT
422
492
  {
423
493
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
424
494
 
425
- if(force)
495
+ if(mode == ICE_SCOPED_ENUM(ConnectionClose, Forcefully))
496
+ {
497
+ setState(StateClosed, ConnectionManuallyClosedException(__FILE__, __LINE__, false));
498
+ }
499
+ else if(mode == ICE_SCOPED_ENUM(ConnectionClose, Gracefully))
426
500
  {
427
- setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
501
+ setState(StateClosing, ConnectionManuallyClosedException(__FILE__, __LINE__, true));
428
502
  }
429
503
  else
430
504
  {
505
+ assert(mode == ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
506
+
431
507
  //
432
- // If we do a graceful shutdown, then we wait until all
433
- // outstanding requests have been completed. Otherwise, the
434
- // CloseConnectionException will cause all outstanding
435
- // requests to be retried, regardless of whether the server
436
- // has processed them or not.
508
+ // Wait until all outstanding requests have been completed.
437
509
  //
438
- while(!_requests.empty() || !_asyncRequests.empty())
510
+ while(!_asyncRequests.empty())
439
511
  {
440
512
  wait();
441
513
  }
442
514
 
443
- setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
515
+ setState(StateClosing, ConnectionManuallyClosedException(__FILE__, __LINE__, true));
444
516
  }
445
517
  }
446
518
 
@@ -486,7 +558,7 @@ Ice::ConnectionI::throwException() const
486
558
  {
487
559
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
488
560
 
489
- if(_exception.get())
561
+ if(_exception)
490
562
  {
491
563
  assert(_state >= StateClosing);
492
564
  _exception->ice_throw();
@@ -538,10 +610,12 @@ Ice::ConnectionI::updateObserver()
538
610
  }
539
611
 
540
612
  assert(_instance->initializationData().observer);
541
- _observer.attach(_instance->initializationData().observer->getConnectionObserver(initConnectionInfo(),
542
- _endpoint,
543
- toConnectionState(_state),
544
- _observer.get()));
613
+
614
+ ConnectionObserverPtr o = _instance->initializationData().observer->getConnectionObserver(initConnectionInfo(),
615
+ _endpoint,
616
+ toConnectionState(_state),
617
+ _observer.get());
618
+ _observer.attach(o);
545
619
  }
546
620
 
547
621
  void
@@ -557,21 +631,22 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
557
631
  //
558
632
  // We send a heartbeat if there was no activity in the last
559
633
  // (timeout / 4) period. Sending a heartbeat sooner than really
560
- // needed is safer to ensure that the receiver will receive in
561
- // time the heartbeat. Sending the heartbeat if there was no
634
+ // needed is safer to ensure that the receiver will receive the
635
+ // heartbeat in time. Sending the heartbeat if there was no
562
636
  // activity in the last (timeout / 2) period isn't enough since
563
637
  // monitor() is called only every (timeout / 2) period.
564
638
  //
565
639
  // Note that this doesn't imply that we are sending 4 heartbeats
566
- // per timeout period because the monitor() method is sill only
640
+ // per timeout period because the monitor() method is still only
567
641
  // called every (timeout / 2) period.
568
642
  //
569
- if(acm.heartbeat == HeartbeatAlways ||
570
- (acm.heartbeat != HeartbeatOff && _writeStream.b.empty() && now >= (_acmLastActivity + acm.timeout / 4)))
643
+ if(acm.heartbeat == ICE_ENUM(ACMHeartbeat, HeartbeatAlways) ||
644
+ (acm.heartbeat != ICE_ENUM(ACMHeartbeat, HeartbeatOff) &&
645
+ _writeStream.b.empty() && now >= (_acmLastActivity + acm.timeout / 4)))
571
646
  {
572
- if(acm.heartbeat != HeartbeatOnInvocation || _dispatchCount > 0)
647
+ if(acm.heartbeat != ICE_ENUM(ACMHeartbeat, HeartbeatOnDispatch) || _dispatchCount > 0)
573
648
  {
574
- heartbeat();
649
+ sendHeartbeatNow();
575
650
  }
576
651
  }
577
652
 
@@ -586,10 +661,10 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
586
661
  return;
587
662
  }
588
663
 
589
- if(acm.close != CloseOff && now >= (_acmLastActivity + acm.timeout))
664
+ if(acm.close != ICE_ENUM(ACMClose, CloseOff) && now >= (_acmLastActivity + acm.timeout))
590
665
  {
591
- if(acm.close == CloseOnIdleForceful ||
592
- (acm.close != CloseOnIdle && (!_requests.empty() || !_asyncRequests.empty())))
666
+ if(acm.close == ICE_ENUM(ACMClose, CloseOnIdleForceful) ||
667
+ (acm.close != ICE_ENUM(ACMClose, CloseOnIdle) && !_asyncRequests.empty()))
593
668
  {
594
669
  //
595
670
  // Close the connection if we didn't receive a heartbeat in
@@ -597,8 +672,8 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
597
672
  //
598
673
  setState(StateClosed, ConnectionTimeoutException(__FILE__, __LINE__));
599
674
  }
600
- else if(acm.close != CloseOnInvocation &&
601
- _dispatchCount == 0 && _batchRequestQueue->isEmpty() && _requests.empty() && _asyncRequests.empty())
675
+ else if(acm.close != ICE_ENUM(ACMClose, CloseOnInvocation) &&
676
+ _dispatchCount == 0 && _batchRequestQueue->isEmpty() && _asyncRequests.empty())
602
677
  {
603
678
  //
604
679
  // The connection is idle, close it.
@@ -608,110 +683,21 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
608
683
  }
609
684
  }
610
685
 
611
- bool
612
- Ice::ConnectionI::sendRequest(OutgoingBase* out, bool compress, bool response, int batchRequestNum)
613
- {
614
- BasicStream* os = out->os();
615
-
616
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
617
- if(_exception.get())
618
- {
619
- //
620
- // If the connection is closed before we even have a chance
621
- // to send our request, we always try to send the request
622
- // again.
623
- //
624
- throw RetryException(*_exception.get());
625
- }
626
-
627
- assert(_state > StateNotValidated);
628
- assert(_state < StateClosing);
629
-
630
- //
631
- // Ensure the message isn't bigger than what we can send with the
632
- // transport.
633
- //
634
- _transceiver->checkSendSize(*os);
635
-
636
- Int requestId = 0;
637
- if(response)
638
- {
639
- //
640
- // Create a new unique request ID.
641
- //
642
- requestId = _nextRequestId++;
643
- if(requestId <= 0)
644
- {
645
- _nextRequestId = 1;
646
- requestId = _nextRequestId++;
647
- }
648
-
649
- //
650
- // Fill in the request ID.
651
- //
652
- const Byte* p = reinterpret_cast<const Byte*>(&requestId);
653
- #ifdef ICE_BIG_ENDIAN
654
- reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize);
655
- #else
656
- copy(p, p + sizeof(Int), os->b.begin() + headerSize);
657
- #endif
658
- }
659
- else if(batchRequestNum > 0)
660
- {
661
- const Byte* p = reinterpret_cast<const Byte*>(&batchRequestNum);
662
- #ifdef ICE_BIG_ENDIAN
663
- reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize);
664
- #else
665
- copy(p, p + sizeof(Int), os->b.begin() + headerSize);
666
- #endif
667
- }
668
-
669
- out->attachRemoteObserver(initConnectionInfo(), _endpoint, requestId);
670
-
671
- //
672
- // Send the message. If it can't be sent without blocking the message is added
673
- // to _sendStreams and it will be sent by the selector thread.
674
- //
675
- bool sent = false;
676
- try
677
- {
678
- OutgoingMessage message(out, os, compress, requestId);
679
- sent = sendMessage(message) & AsyncStatusSent;
680
- }
681
- catch(const LocalException& ex)
682
- {
683
- setState(StateClosed, ex);
684
- assert(_exception.get());
685
- _exception->ice_throw();
686
- }
687
-
688
- if(response)
689
- {
690
- //
691
- // Add to the requests map.
692
- //
693
- _requestsHint = _requests.insert(_requests.end(), pair<const Int, OutgoingBase*>(requestId, out));
694
- }
695
-
696
- return sent;
697
- }
698
-
699
686
  AsyncStatus
700
687
  Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compress, bool response, int batchRequestNum)
701
688
  {
702
- BasicStream* os = out->getOs();
689
+ OutputStream* os = out->getOs();
703
690
 
704
691
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
705
- if(_exception.get())
692
+ //
693
+ // If the exception is closed before we even have a chance
694
+ // to send our request, we always try to send the request
695
+ // again.
696
+ //
697
+ if(_exception)
706
698
  {
707
- //
708
- // If the exception is closed before we even have a chance
709
- // to send our request, we always try to send the request
710
- // again.
711
- //
712
- throw RetryException(*_exception.get());
699
+ throw RetryException(*_exception);
713
700
  }
714
-
715
701
  assert(_state > StateNotValidated);
716
702
  assert(_state < StateClosing);
717
703
 
@@ -725,8 +711,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
725
711
  // Notify the request that it's cancelable with this connection.
726
712
  // This will throw if the request is canceled.
727
713
  //
728
- out->cancelable(this);
729
-
714
+ out->cancelable(ICE_SHARED_FROM_THIS);
730
715
  Int requestId = 0;
731
716
  if(response)
732
717
  {
@@ -771,7 +756,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
771
756
  catch(const LocalException& ex)
772
757
  {
773
758
  setState(StateClosed, ex);
774
- assert(_exception.get());
759
+ assert(_exception);
775
760
  _exception->ice_throw();
776
761
  }
777
762
 
@@ -792,283 +777,416 @@ Ice::ConnectionI::getBatchRequestQueue() const
792
777
  return _batchRequestQueue;
793
778
  }
794
779
 
780
+ #ifdef ICE_CPP11_MAPPING
781
+ std::function<void()>
782
+ Ice::ConnectionI::flushBatchRequestsAsync(CompressBatch compress,
783
+ ::std::function<void(::std::exception_ptr)> ex,
784
+ ::std::function<void(bool)> sent)
785
+ {
786
+ class ConnectionFlushBatchLambda : public ConnectionFlushBatchAsync, public LambdaInvoke
787
+ {
788
+ public:
789
+
790
+ ConnectionFlushBatchLambda(std::shared_ptr<Ice::ConnectionI>&& connection,
791
+ const InstancePtr& instance,
792
+ std::function<void(std::exception_ptr)> ex,
793
+ std::function<void(bool)> sent) :
794
+ ConnectionFlushBatchAsync(connection, instance), LambdaInvoke(std::move(ex), std::move(sent))
795
+ {
796
+ }
797
+ };
798
+ auto outAsync = make_shared<ConnectionFlushBatchLambda>(ICE_SHARED_FROM_THIS, _instance, ex, sent);
799
+ outAsync->invoke(flushBatchRequests_name, compress);
800
+ return [outAsync]() { outAsync->cancel(); };
801
+ }
802
+ #else
795
803
  void
796
- Ice::ConnectionI::flushBatchRequests()
804
+ Ice::ConnectionI::flushBatchRequests(CompressBatch compress)
797
805
  {
798
- ConnectionFlushBatch out(this, _instance.get(), __flushBatchRequests_name);
799
- out.invoke();
806
+ end_flushBatchRequests(begin_flushBatchRequests(compress));
800
807
  }
801
808
 
802
809
  AsyncResultPtr
803
- Ice::ConnectionI::begin_flushBatchRequests()
810
+ Ice::ConnectionI::begin_flushBatchRequests(CompressBatch compress)
804
811
  {
805
- return __begin_flushBatchRequests(__dummyCallback, 0);
812
+ return _iceI_begin_flushBatchRequests(compress, dummyCallback, 0);
806
813
  }
807
814
 
808
815
  AsyncResultPtr
809
- Ice::ConnectionI::begin_flushBatchRequests(const CallbackPtr& cb, const LocalObjectPtr& cookie)
816
+ Ice::ConnectionI::begin_flushBatchRequests(CompressBatch compress,
817
+ const CallbackPtr& cb,
818
+ const LocalObjectPtr& cookie)
810
819
  {
811
- return __begin_flushBatchRequests(cb, cookie);
820
+ return _iceI_begin_flushBatchRequests(compress, cb, cookie);
812
821
  }
813
822
 
814
823
  AsyncResultPtr
815
- Ice::ConnectionI::begin_flushBatchRequests(const Callback_Connection_flushBatchRequestsPtr& cb,
824
+ Ice::ConnectionI::begin_flushBatchRequests(CompressBatch compress,
825
+ const Callback_Connection_flushBatchRequestsPtr& cb,
816
826
  const LocalObjectPtr& cookie)
817
827
  {
818
- return __begin_flushBatchRequests(cb, cookie);
828
+ return _iceI_begin_flushBatchRequests(compress, cb, cookie);
819
829
  }
820
830
 
821
831
  AsyncResultPtr
822
- Ice::ConnectionI::begin_flushBatchRequests(const IceInternal::Function<void (const Exception&)>& exception,
823
- const IceInternal::Function<void (bool)>& sent)
832
+ Ice::ConnectionI::_iceI_begin_flushBatchRequests(CompressBatch compress,
833
+ const CallbackBasePtr& cb,
834
+ const LocalObjectPtr& cookie)
824
835
  {
825
- #ifdef ICE_CPP11
826
- class Cpp11CB : public IceInternal::Cpp11FnCallbackNC
836
+ class ConnectionFlushBatchAsyncWithCallback : public ConnectionFlushBatchAsync, public CallbackCompletion
827
837
  {
828
838
  public:
829
839
 
830
- Cpp11CB(const IceInternal::Function<void (const Exception&)>& excb,
831
- const IceInternal::Function<void (bool)>& sentcb) :
832
- IceInternal::Cpp11FnCallbackNC(excb, sentcb)
840
+ ConnectionFlushBatchAsyncWithCallback(const Ice::ConnectionIPtr& connection,
841
+ const Ice::CommunicatorPtr& communicator,
842
+ const InstancePtr& instance,
843
+ const CallbackBasePtr& callback,
844
+ const Ice::LocalObjectPtr& cookie) :
845
+ ConnectionFlushBatchAsync(connection, instance),
846
+ CallbackCompletion(callback, cookie),
847
+ _communicator(communicator),
848
+ _connection(connection)
833
849
  {
834
- CallbackBase::checkCallback(true, excb != nullptr);
850
+ _cookie = cookie;
835
851
  }
836
852
 
837
- virtual void
838
- completed(const AsyncResultPtr& __result) const
853
+ virtual Ice::CommunicatorPtr getCommunicator() const
839
854
  {
840
- ConnectionPtr __con = __result->getConnection();
841
- assert(__con);
842
- try
843
- {
844
- __con->end_flushBatchRequests(__result);
845
- assert(false);
846
- }
847
- catch(const Exception& ex)
848
- {
849
- IceInternal::Cpp11FnCallbackNC::exception(__result, ex);
850
- }
855
+ return _communicator;
851
856
  }
852
- };
853
857
 
854
- return __begin_flushBatchRequests(new Cpp11CB(exception, sent), 0);
855
- #else
856
- assert(false); // Ice not built with C++11 support.
857
- return 0;
858
- #endif
859
- }
858
+ virtual Ice::ConnectionPtr getConnection() const
859
+ {
860
+ return _connection;
861
+ }
860
862
 
861
- AsyncResultPtr
862
- Ice::ConnectionI::__begin_flushBatchRequests(const CallbackBasePtr& cb, const LocalObjectPtr& cookie)
863
- {
864
- ConnectionFlushBatchAsyncPtr result = new ConnectionFlushBatchAsync(this,
865
- _communicator,
866
- _instance,
867
- __flushBatchRequests_name,
868
- cb,
869
- cookie);
870
- result->invoke();
863
+ virtual const std::string&
864
+ getOperation() const
865
+ {
866
+ return flushBatchRequests_name;
867
+ }
868
+
869
+ private:
870
+
871
+ Ice::CommunicatorPtr _communicator;
872
+ Ice::ConnectionPtr _connection;
873
+ };
874
+
875
+ ConnectionFlushBatchAsyncPtr result = new ConnectionFlushBatchAsyncWithCallback(this,
876
+ _communicator,
877
+ _instance,
878
+ cb,
879
+ cookie);
880
+ result->invoke(flushBatchRequests_name, compress);
871
881
  return result;
872
882
  }
873
883
 
874
884
  void
875
885
  Ice::ConnectionI::end_flushBatchRequests(const AsyncResultPtr& r)
876
886
  {
877
- AsyncResult::__check(r, this, __flushBatchRequests_name);
878
- r->__wait();
887
+ AsyncResult::_check(r, this, flushBatchRequests_name);
888
+ r->_waitForResponse();
879
889
  }
890
+ #endif
880
891
 
881
- void
882
- Ice::ConnectionI::setCallback(const ConnectionCallbackPtr& callback)
892
+ namespace
883
893
  {
894
+
895
+ const ::std::string heartbeat_name = "heartbeat";
896
+
897
+ class HeartbeatAsync : public OutgoingAsyncBase
898
+ {
899
+ public:
900
+
901
+ HeartbeatAsync(const ConnectionIPtr& connection,
902
+ const CommunicatorPtr& communicator,
903
+ const InstancePtr& instance) :
904
+ OutgoingAsyncBase(instance),
905
+ _communicator(communicator),
906
+ _connection(connection)
884
907
  {
885
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
886
- if(_state >= StateClosed)
887
- {
888
- if(callback)
889
- {
890
- class CallbackWorkItem : public DispatchWorkItem
891
- {
892
- public:
908
+ }
893
909
 
894
- CallbackWorkItem(const ConnectionIPtr& connection, const ConnectionCallbackPtr& callback) :
895
- _connection(connection),
896
- _callback(callback)
897
- {
898
- }
910
+ virtual CommunicatorPtr getCommunicator() const
911
+ {
912
+ return _communicator;
913
+ }
899
914
 
900
- virtual void run()
901
- {
902
- _connection->closeCallback(_callback);
903
- }
915
+ virtual ConnectionPtr getConnection() const
916
+ {
917
+ return _connection;
918
+ }
904
919
 
905
- private:
920
+ virtual const string& getOperation() const
921
+ {
922
+ return heartbeat_name;
923
+ }
906
924
 
907
- const ConnectionIPtr _connection;
908
- const ConnectionCallbackPtr _callback;
909
- };
910
- _threadPool->dispatch(new CallbackWorkItem(this, callback));
925
+ void invoke()
926
+ {
927
+ _observer.attach(_instance.get(), heartbeat_name);
928
+ try
929
+ {
930
+ _os.write(magic[0]);
931
+ _os.write(magic[1]);
932
+ _os.write(magic[2]);
933
+ _os.write(magic[3]);
934
+ _os.write(currentProtocol);
935
+ _os.write(currentProtocolEncoding);
936
+ _os.write(validateConnectionMsg);
937
+ _os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
938
+ _os.write(headerSize); // Message size.
939
+ _os.i = _os.b.begin();
940
+
941
+ AsyncStatus status = _connection->sendAsyncRequest(ICE_SHARED_FROM_THIS, false, false, 0);
942
+ if(status & AsyncStatusSent)
943
+ {
944
+ _sentSynchronously = true;
945
+ if(status & AsyncStatusInvokeSentCallback)
946
+ {
947
+ invokeSent();
948
+ }
911
949
  }
912
950
  }
913
- else
951
+ catch(const RetryException& ex)
952
+ {
953
+ if(exception(*ex.get()))
954
+ {
955
+ invokeExceptionAsync();
956
+ }
957
+ }
958
+ catch(const Exception& ex)
914
959
  {
915
- _callback = callback;
960
+ if(exception(ex))
961
+ {
962
+ invokeExceptionAsync();
963
+ }
916
964
  }
917
965
  }
966
+
967
+ private:
968
+
969
+ CommunicatorPtr _communicator;
970
+ ConnectionIPtr _connection;
971
+ };
972
+ typedef IceUtil::Handle<HeartbeatAsync> HeartbeatAsyncPtr;
973
+
918
974
  }
919
975
 
976
+ #ifdef ICE_CPP11_MAPPING
920
977
  void
921
- Ice::ConnectionI::closeCallback(const ConnectionCallbackPtr& callback)
978
+ Ice::ConnectionI::heartbeat()
922
979
  {
923
- try
924
- {
925
- callback->closed(this);
926
- }
927
- catch(const std::exception& ex)
928
- {
929
- Error out(_instance->initializationData().logger);
930
- out << "connection callback exception:\n" << ex << '\n' << _desc;
931
- }
932
- catch(...)
933
- {
934
- Error out(_instance->initializationData().logger);
935
- out << "connection callback exception:\nunknown c++ exception" << '\n' << _desc;
936
- }
980
+ Connection::heartbeatAsync().get();
937
981
  }
938
982
 
939
- void
940
- Ice::ConnectionI::setACM(const IceUtil::Optional<int>& timeout,
941
- const IceUtil::Optional<Ice::ACMClose>& close,
942
- const IceUtil::Optional<Ice::ACMHeartbeat>& heartbeat)
983
+ std::function<void()>
984
+ Ice::ConnectionI::heartbeatAsync(::std::function<void(::std::exception_ptr)> ex, ::std::function<void(bool)> sent)
943
985
  {
944
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
945
- if(!_monitor || _state >= StateClosed)
986
+ class HeartbeatLambda : public HeartbeatAsync, public LambdaInvoke
946
987
  {
947
- return;
948
- }
988
+ public:
949
989
 
950
- if(_state == StateActive)
951
- {
952
- _monitor->remove(this);
953
- }
954
- _monitor = _monitor->acm(timeout, close, heartbeat);
990
+ HeartbeatLambda(std::shared_ptr<Ice::ConnectionI>&& connection,
991
+ std::shared_ptr<Ice::Communicator>& communicator,
992
+ const InstancePtr& instance,
993
+ std::function<void(std::exception_ptr)> ex,
994
+ std::function<void(bool)> sent) :
995
+ HeartbeatAsync(connection, communicator, instance), LambdaInvoke(std::move(ex), std::move(sent))
996
+ {
997
+ }
998
+ };
999
+ auto outAsync = make_shared<HeartbeatLambda>(ICE_SHARED_FROM_THIS, _communicator, _instance, ex, sent);
1000
+ outAsync->invoke();
1001
+ return [outAsync]() { outAsync->cancel(); };
1002
+ }
1003
+ #else
1004
+ void
1005
+ Ice::ConnectionI::heartbeat()
1006
+ {
1007
+ end_heartbeat(begin_heartbeat());
1008
+ }
955
1009
 
956
- if(_monitor->getACM().timeout <= 0)
957
- {
958
- _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity.
959
- }
960
- else if(_acmLastActivity == IceUtil::Time() && _state == StateActive)
961
- {
962
- _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
963
- }
1010
+ AsyncResultPtr
1011
+ Ice::ConnectionI::begin_heartbeat()
1012
+ {
1013
+ return _iceI_begin_heartbeat(dummyCallback, 0);
1014
+ }
964
1015
 
965
- if(_state == StateActive)
1016
+ AsyncResultPtr
1017
+ Ice::ConnectionI::begin_heartbeat(const CallbackPtr& cb, const LocalObjectPtr& cookie)
1018
+ {
1019
+ return _iceI_begin_heartbeat(cb, cookie);
1020
+ }
1021
+
1022
+ AsyncResultPtr
1023
+ Ice::ConnectionI::begin_heartbeat(const Callback_Connection_heartbeatPtr& cb, const LocalObjectPtr& cookie)
1024
+ {
1025
+ return _iceI_begin_heartbeat(cb, cookie);
1026
+ }
1027
+
1028
+ AsyncResultPtr
1029
+ Ice::ConnectionI::_iceI_begin_heartbeat(const CallbackBasePtr& cb, const LocalObjectPtr& cookie)
1030
+ {
1031
+ class HeartbeatCallback : public HeartbeatAsync, public CallbackCompletion
966
1032
  {
967
- _monitor->add(this);
968
- }
1033
+ public:
1034
+
1035
+ HeartbeatCallback(const ConnectionIPtr& connection,
1036
+ const CommunicatorPtr& communicator,
1037
+ const InstancePtr& instance,
1038
+ const CallbackBasePtr& callback,
1039
+ const LocalObjectPtr& cookie) :
1040
+ HeartbeatAsync(connection, communicator, instance),
1041
+ CallbackCompletion(callback, cookie)
1042
+ {
1043
+ _cookie = cookie;
1044
+ }
1045
+ };
1046
+
1047
+ HeartbeatAsyncPtr result = new HeartbeatCallback(this, _communicator, _instance, cb, cookie);
1048
+ result->invoke();
1049
+ return result;
969
1050
  }
970
1051
 
971
- ACM
972
- Ice::ConnectionI::getACM()
1052
+ void
1053
+ Ice::ConnectionI::end_heartbeat(const AsyncResultPtr& r)
973
1054
  {
974
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
975
- ACM acm;
976
- acm.timeout = 0;
977
- acm.close = CloseOff;
978
- acm.heartbeat = HeartbeatOff;
979
- return _monitor ? _monitor->getACM() : acm;
1055
+ AsyncResult::_check(r, this, heartbeat_name);
1056
+ r->_waitForResponse();
980
1057
  }
1058
+ #endif
981
1059
 
982
1060
  void
983
- Ice::ConnectionI::requestCanceled(OutgoingBase* out, const Ice::LocalException& ex)
1061
+ Ice::ConnectionI::setHeartbeatCallback(ICE_IN(ICE_DELEGATE(HeartbeatCallback)) callback)
984
1062
  {
985
1063
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
986
1064
  if(_state >= StateClosed)
987
1065
  {
988
- return; // The request has already been or will be shortly notified of the failure.
1066
+ return;
989
1067
  }
1068
+ _heartbeatCallback = callback;
1069
+ }
990
1070
 
991
- for(deque<OutgoingMessage>::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o)
1071
+ void
1072
+ Ice::ConnectionI::setCloseCallback(ICE_IN(ICE_DELEGATE(CloseCallback)) callback)
1073
+ {
1074
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1075
+ if(_state >= StateClosed)
992
1076
  {
993
- if(o->out == out)
1077
+ if(callback)
994
1078
  {
995
- if(o->requestId)
1079
+ class CallbackWorkItem : public DispatchWorkItem
996
1080
  {
997
- if(_requestsHint != _requests.end() && _requestsHint->second == out)
998
- {
999
- _requests.erase(_requestsHint);
1000
- _requestsHint = _requests.end();
1001
- }
1002
- else
1003
- {
1004
- _requests.erase(o->requestId);
1005
- }
1006
- }
1081
+ public:
1007
1082
 
1008
- if(dynamic_cast<const Ice::ConnectionTimeoutException*>(&ex))
1009
- {
1010
- setState(StateClosed, ex);
1011
- }
1012
- else
1013
- {
1014
- //
1015
- // If the request is being sent, don't remove it from the send streams,
1016
- // it will be removed once the sending is finished.
1017
- //
1018
- if(o == _sendStreams.begin())
1083
+ CallbackWorkItem(const ConnectionIPtr& connection, ICE_IN(ICE_DELEGATE(CloseCallback)) callback) :
1084
+ _connection(connection),
1085
+ #ifdef ICE_CPP11_MAPPING
1086
+ _callback(move(callback))
1087
+ #else
1088
+ _callback(callback)
1089
+ #endif
1019
1090
  {
1020
- o->canceled(true); // true = adopt the stream.
1021
1091
  }
1022
- else
1092
+
1093
+ virtual void run()
1023
1094
  {
1024
- o->canceled(false);
1025
- _sendStreams.erase(o);
1095
+ _connection->closeCallback(_callback);
1026
1096
  }
1027
- out->completed(ex);
1028
- }
1029
- return;
1097
+
1098
+ private:
1099
+
1100
+ const ConnectionIPtr _connection;
1101
+ const ICE_DELEGATE(CloseCallback) _callback;
1102
+ };
1103
+ #ifdef ICE_CPP11_MAPPING
1104
+ _threadPool->dispatch(new CallbackWorkItem(ICE_SHARED_FROM_THIS, move(callback)));
1105
+ #else
1106
+ _threadPool->dispatch(new CallbackWorkItem(ICE_SHARED_FROM_THIS, callback));
1107
+ #endif
1030
1108
  }
1031
1109
  }
1110
+ else
1111
+ {
1112
+ _closeCallback = callback;
1113
+ }
1114
+ }
1032
1115
 
1033
- if(dynamic_cast<Outgoing*>(out))
1116
+ void
1117
+ Ice::ConnectionI::closeCallback(const ICE_DELEGATE(CloseCallback)& callback)
1118
+ {
1119
+ try
1034
1120
  {
1035
- if(_requestsHint != _requests.end() && _requestsHint->second == out)
1036
- {
1037
- if(dynamic_cast<const Ice::ConnectionTimeoutException*>(&ex))
1038
- {
1039
- setState(StateClosed, ex);
1040
- }
1041
- else
1042
- {
1043
- out->completed(ex);
1044
- _requests.erase(_requestsHint);
1045
- _requestsHint = _requests.end();
1046
- }
1047
- return;
1048
- }
1049
- else
1050
- {
1051
- for(map<Int, OutgoingBase*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
1052
- {
1053
- if(p->second == out)
1054
- {
1055
- if(dynamic_cast<const Ice::ConnectionTimeoutException*>(&ex))
1056
- {
1057
- setState(StateClosed, ex);
1058
- }
1059
- else
1060
- {
1061
- p->second->completed(ex);
1062
- assert(p != _requestsHint);
1063
- _requests.erase(p);
1064
- }
1065
- return; // We're done.
1066
- }
1067
- }
1068
- }
1121
+ #ifdef ICE_CPP11_MAPPING
1122
+ callback(ICE_SHARED_FROM_THIS);
1123
+ #else
1124
+ callback->closed(ICE_SHARED_FROM_THIS);
1125
+ #endif
1126
+ }
1127
+ catch(const std::exception& ex)
1128
+ {
1129
+ Error out(_instance->initializationData().logger);
1130
+ out << "connection callback exception:\n" << ex << '\n' << _desc;
1131
+ }
1132
+ catch(...)
1133
+ {
1134
+ Error out(_instance->initializationData().logger);
1135
+ out << "connection callback exception:\nunknown c++ exception" << '\n' << _desc;
1136
+ }
1137
+ }
1138
+
1139
+ void
1140
+ Ice::ConnectionI::setACM(const IceUtil::Optional<int>& timeout,
1141
+ const IceUtil::Optional<Ice::ACMClose>& close,
1142
+ const IceUtil::Optional<Ice::ACMHeartbeat>& heartbeat)
1143
+ {
1144
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1145
+ if(timeout && *timeout < 0)
1146
+ {
1147
+ #ifdef ICE_CPP11_MAPPING
1148
+ throw invalid_argument("invalid negative ACM timeout value");
1149
+ #else
1150
+ throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "invalid negative ACM timeout value");
1151
+ #endif
1152
+ }
1153
+ if(!_monitor || _state >= StateClosed)
1154
+ {
1155
+ return;
1156
+ }
1157
+
1158
+ if(_state == StateActive)
1159
+ {
1160
+ _monitor->remove(ICE_SHARED_FROM_THIS);
1161
+ }
1162
+ _monitor = _monitor->acm(timeout, close, heartbeat);
1163
+
1164
+ if(_monitor->getACM().timeout <= 0)
1165
+ {
1166
+ _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity.
1167
+ }
1168
+ else if(_acmLastActivity == IceUtil::Time() && _state == StateActive)
1169
+ {
1170
+ _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
1171
+ }
1172
+
1173
+ if(_state == StateActive)
1174
+ {
1175
+ _monitor->add(ICE_SHARED_FROM_THIS);
1069
1176
  }
1070
1177
  }
1071
1178
 
1179
+ ACM
1180
+ Ice::ConnectionI::getACM() ICE_NOEXCEPT
1181
+ {
1182
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1183
+ ACM acm;
1184
+ acm.timeout = 0;
1185
+ acm.close = ICE_ENUM(ACMClose, CloseOff);
1186
+ acm.heartbeat = ICE_ENUM(ACMHeartbeat, HeartbeatOff);
1187
+ return _monitor ? _monitor->getACM() : acm;
1188
+ }
1189
+
1072
1190
  void
1073
1191
  Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, const LocalException& ex)
1074
1192
  {
@@ -1089,7 +1207,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1089
1207
  if(o->requestId)
1090
1208
  {
1091
1209
  if(_asyncRequestsHint != _asyncRequests.end() &&
1092
- _asyncRequestsHint->second == OutgoingAsyncPtr::dynamicCast(outAsync))
1210
+ _asyncRequestsHint->second == ICE_DYNAMIC_CAST(OutgoingAsync, outAsync))
1093
1211
  {
1094
1212
  _asyncRequests.erase(_asyncRequestsHint);
1095
1213
  _asyncRequestsHint = _asyncRequests.end();
@@ -1119,16 +1237,16 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1119
1237
  o->canceled(false);
1120
1238
  _sendStreams.erase(o);
1121
1239
  }
1122
- if(outAsync->completed(ex))
1240
+ if(outAsync->exception(ex))
1123
1241
  {
1124
- outAsync->invokeCompletedAsync();
1242
+ outAsync->invokeExceptionAsync();
1125
1243
  }
1126
1244
  }
1127
1245
  return;
1128
1246
  }
1129
1247
  }
1130
1248
 
1131
- if(OutgoingAsyncPtr::dynamicCast(outAsync))
1249
+ if(ICE_DYNAMIC_CAST(OutgoingAsync, outAsync))
1132
1250
  {
1133
1251
  if(_asyncRequestsHint != _asyncRequests.end())
1134
1252
  {
@@ -1142,9 +1260,9 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1142
1260
  {
1143
1261
  _asyncRequests.erase(_asyncRequestsHint);
1144
1262
  _asyncRequestsHint = _asyncRequests.end();
1145
- if(outAsync->completed(ex))
1263
+ if(outAsync->exception(ex))
1146
1264
  {
1147
- outAsync->invokeCompletedAsync();
1265
+ outAsync->invokeExceptionAsync();
1148
1266
  }
1149
1267
  }
1150
1268
  return;
@@ -1163,9 +1281,9 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1163
1281
  {
1164
1282
  assert(p != _asyncRequestsHint);
1165
1283
  _asyncRequests.erase(p);
1166
- if(outAsync->completed(ex))
1284
+ if(outAsync->exception(ex))
1167
1285
  {
1168
- outAsync->invokeCompletedAsync();
1286
+ outAsync->invokeExceptionAsync();
1169
1287
  }
1170
1288
  }
1171
1289
  return;
@@ -1175,7 +1293,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1175
1293
  }
1176
1294
 
1177
1295
  void
1178
- Ice::ConnectionI::sendResponse(Int, BasicStream* os, Byte compressFlag, bool /*amd*/)
1296
+ Ice::ConnectionI::sendResponse(Int, OutputStream* os, Byte compressFlag, bool /*amd*/)
1179
1297
  {
1180
1298
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1181
1299
  assert(_state > StateNotValidated);
@@ -1193,7 +1311,7 @@ Ice::ConnectionI::sendResponse(Int, BasicStream* os, Byte compressFlag, bool /*a
1193
1311
 
1194
1312
  if(_state >= StateClosed)
1195
1313
  {
1196
- assert(_exception.get());
1314
+ assert(_exception);
1197
1315
  _exception->ice_throw();
1198
1316
  }
1199
1317
 
@@ -1232,7 +1350,7 @@ Ice::ConnectionI::sendNoResponse()
1232
1350
 
1233
1351
  if(_state >= StateClosed)
1234
1352
  {
1235
- assert(_exception.get());
1353
+ assert(_exception);
1236
1354
  _exception->ice_throw();
1237
1355
  }
1238
1356
 
@@ -1294,25 +1412,21 @@ Ice::ConnectionI::connector() const
1294
1412
  void
1295
1413
  Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter)
1296
1414
  {
1297
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1298
-
1299
- if(_state <= StateNotValidated || _state >= StateClosing)
1415
+ if(adapter)
1300
1416
  {
1301
- return;
1417
+ // Go through the adapter to set the adapter and servant manager on this connection
1418
+ // to ensure the object adapter is still active.
1419
+ dynamic_cast<ObjectAdapterI*>(adapter.get())->setAdapterOnConnection(ICE_SHARED_FROM_THIS);
1302
1420
  }
1303
-
1304
- _adapter = adapter;
1305
-
1306
- if(_adapter)
1421
+ else
1307
1422
  {
1308
- _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager();
1309
- if(!_servantManager)
1423
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1424
+ if(_state <= StateNotValidated || _state >= StateClosing)
1310
1425
  {
1311
- _adapter = 0;
1426
+ return;
1312
1427
  }
1313
- }
1314
- else
1315
- {
1428
+
1429
+ _adapter = 0;
1316
1430
  _servantManager = 0;
1317
1431
  }
1318
1432
 
@@ -1323,30 +1437,44 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter)
1323
1437
  }
1324
1438
 
1325
1439
  ObjectAdapterPtr
1326
- Ice::ConnectionI::getAdapter() const
1440
+ Ice::ConnectionI::getAdapter() const ICE_NOEXCEPT
1327
1441
  {
1328
1442
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1329
1443
  return _adapter;
1330
1444
  }
1331
1445
 
1332
1446
  EndpointPtr
1333
- Ice::ConnectionI::getEndpoint() const
1447
+ Ice::ConnectionI::getEndpoint() const ICE_NOEXCEPT
1334
1448
  {
1335
1449
  return _endpoint; // No mutex protection necessary, _endpoint is immutable.
1336
1450
  }
1337
1451
 
1338
- ObjectPrx
1452
+ ObjectPrxPtr
1339
1453
  Ice::ConnectionI::createProxy(const Identity& ident) const
1340
1454
  {
1341
1455
  //
1342
1456
  // Create a reference and return a reverse proxy for this
1343
1457
  // reference.
1344
1458
  //
1345
- ConnectionIPtr self = const_cast<ConnectionI*>(this);
1346
- return _instance->proxyFactory()->referenceToProxy(_instance->referenceFactory()->create(ident, self));
1459
+ return _instance->proxyFactory()->referenceToProxy(
1460
+ _instance->referenceFactory()->create(ident, ICE_SHARED_FROM_CONST_THIS(ConnectionI)));
1461
+ }
1462
+
1463
+ void
1464
+ Ice::ConnectionI::setAdapterAndServantManager(const ObjectAdapterPtr& adapter,
1465
+ const IceInternal::ServantManagerPtr& servantManager)
1466
+ {
1467
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1468
+ if(_state <= StateNotValidated || _state >= StateClosing)
1469
+ {
1470
+ return;
1471
+ }
1472
+ assert(adapter); // Called by ObjectAdapterI::setAdapterOnConnection
1473
+ _adapter = adapter;
1474
+ _servantManager = servantManager;
1347
1475
  }
1348
1476
 
1349
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
1477
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
1350
1478
  bool
1351
1479
  Ice::ConnectionI::startAsync(SocketOperation operation)
1352
1480
  {
@@ -1372,19 +1500,12 @@ Ice::ConnectionI::startAsync(SocketOperation operation)
1372
1500
  }
1373
1501
  else if(operation & SocketOperationRead)
1374
1502
  {
1375
- if(!_hasMoreData)
1376
- {
1377
- if(_observer && !_readHeader)
1378
- {
1379
- _observer.startRead(_readStream);
1380
- }
1381
-
1382
- _transceiver->startRead(_readStream);
1383
- }
1384
- else
1503
+ if(_observer && !_readHeader)
1385
1504
  {
1386
- _transceiver->getNativeInfo()->completed(IceInternal::SocketOperationRead);
1505
+ _observer.startRead(_readStream);
1387
1506
  }
1507
+
1508
+ _transceiver->startRead(_readStream);
1388
1509
  }
1389
1510
  }
1390
1511
  catch(const Ice::LocalException& ex)
@@ -1422,29 +1543,26 @@ Ice::ConnectionI::finishAsync(SocketOperation operation)
1422
1543
  }
1423
1544
  else if(operation & SocketOperationRead)
1424
1545
  {
1425
- if(!_hasMoreData)
1546
+ Buffer::Container::iterator start = _readStream.i;
1547
+ _transceiver->finishRead(_readStream);
1548
+ if(_instance->traceLevels()->network >= 3 && _readStream.i != start)
1426
1549
  {
1427
- Buffer::Container::iterator start = _readStream.i;
1428
- _transceiver->finishRead(_readStream, _hasMoreData);
1429
- if(_instance->traceLevels()->network >= 3 && _readStream.i != start)
1550
+ Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
1551
+ out << "received ";
1552
+ if(_endpoint->datagram())
1430
1553
  {
1431
- Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
1432
- out << "received ";
1433
- if(_endpoint->datagram())
1434
- {
1435
- out << _readStream.b.size();
1436
- }
1437
- else
1438
- {
1439
- out << (_readStream.i - start) << " of " << (_readStream.b.end() - start);
1440
- }
1441
- out << " bytes via " << _endpoint->protocol() << "\n" << toString();
1554
+ out << _readStream.b.size();
1442
1555
  }
1443
-
1444
- if(_observer && !_readHeader)
1556
+ else
1445
1557
  {
1446
- _observer.finishRead(_readStream);
1558
+ out << (_readStream.i - start) << " of " << (_readStream.b.end() - start);
1447
1559
  }
1560
+ out << " bytes via " << _endpoint->protocol() << "\n" << toString();
1561
+ }
1562
+
1563
+ if(_observer && !_readHeader)
1564
+ {
1565
+ _observer.finishRead(_readStream);
1448
1566
  }
1449
1567
  }
1450
1568
  }
@@ -1467,11 +1585,10 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1467
1585
  ServantManagerPtr servantManager;
1468
1586
  ObjectAdapterPtr adapter;
1469
1587
  OutgoingAsyncBasePtr outAsync;
1470
- ConnectionCallbackPtr heartbeatCallback;
1588
+ ICE_DELEGATE(HeartbeatCallback) heartbeatCallback;
1471
1589
  int dispatchCount = 0;
1472
1590
 
1473
1591
  ThreadPoolMessage<ConnectionI> msg(current, *this);
1474
-
1475
1592
  {
1476
1593
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1477
1594
 
@@ -1533,6 +1650,15 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1533
1650
  _observer->receivedBytes(static_cast<int>(headerSize));
1534
1651
  }
1535
1652
 
1653
+ //
1654
+ // Connection is validated on first message. This is only used by
1655
+ // setState() to check wether or not we can print a connection
1656
+ // warning (a client might close the connection forcefully if the
1657
+ // connection isn't validated, we don't want to print a warning
1658
+ // in this case).
1659
+ //
1660
+ _validated = true;
1661
+
1536
1662
  ptrdiff_t pos = _readStream.i - _readStream.b.begin();
1537
1663
  if(pos < headerSize)
1538
1664
  {
@@ -1547,9 +1673,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1547
1673
  _readStream.readBlob(m, static_cast<Int>(sizeof(magic)));
1548
1674
  if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
1549
1675
  {
1550
- BadMagicException ex(__FILE__, __LINE__);
1551
- ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic));
1552
- throw ex;
1676
+ throw BadMagicException(__FILE__, __LINE__, "", Ice::ByteSeq(&m[0], &m[0] + sizeof(magic)));
1553
1677
  }
1554
1678
  ProtocolVersion pv;
1555
1679
  _readStream.read(pv);
@@ -1560,21 +1684,22 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1560
1684
 
1561
1685
  Byte messageType;
1562
1686
  _readStream.read(messageType);
1563
- Byte compress;
1564
- _readStream.read(compress);
1687
+ Byte compressByte;
1688
+ _readStream.read(compressByte);
1565
1689
  Int size;
1566
1690
  _readStream.read(size);
1567
1691
  if(size < headerSize)
1568
1692
  {
1569
1693
  throw IllegalMessageSizeException(__FILE__, __LINE__);
1570
1694
  }
1695
+
1571
1696
  if(size > static_cast<Int>(_messageSizeMax))
1572
1697
  {
1573
- Ex::throwMemoryLimitException(__FILE__, __LINE__, size, _messageSizeMax);
1698
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, static_cast<size_t>(size), _messageSizeMax);
1574
1699
  }
1575
- if(size > static_cast<Int>(_readStream.b.size()))
1700
+ if(static_cast<size_t>(size) > _readStream.b.size())
1576
1701
  {
1577
- _readStream.b.resize(size);
1702
+ _readStream.b.resize(static_cast<size_t>(size));
1578
1703
  }
1579
1704
  _readStream.i = _readStream.b.begin() + pos;
1580
1705
  }
@@ -1603,7 +1728,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1603
1728
  // satisfied before continuing.
1604
1729
  //
1605
1730
  scheduleTimeout(newOp);
1606
- _threadPool->update(this, current.operation, newOp);
1731
+ _threadPool->update(ICE_SHARED_FROM_THIS, current.operation, newOp);
1607
1732
  return;
1608
1733
  }
1609
1734
 
@@ -1617,7 +1742,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1617
1742
  return;
1618
1743
  }
1619
1744
 
1620
- _threadPool->unregister(this, current.operation);
1745
+ _threadPool->unregister(ICE_SHARED_FROM_THIS, current.operation);
1621
1746
 
1622
1747
  //
1623
1748
  // We start out in holding state.
@@ -1665,7 +1790,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1665
1790
  if(_state < StateClosed)
1666
1791
  {
1667
1792
  scheduleTimeout(newOp);
1668
- _threadPool->update(this, current.operation, newOp);
1793
+ _threadPool->update(ICE_SHARED_FROM_THIS, current.operation, newOp);
1669
1794
  }
1670
1795
  }
1671
1796
 
@@ -1720,6 +1845,12 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1720
1845
  }
1721
1846
  }
1722
1847
 
1848
+ // dispatchFromThisThread dispatches to the correct DispatchQueue
1849
+ #ifdef ICE_SWIFT
1850
+ _threadPool->dispatchFromThisThread(new DispatchCall(ICE_SHARED_FROM_THIS, startCB, sentCBs, compress, requestId,
1851
+ invokeNum, servantManager, adapter, outAsync,
1852
+ heartbeatCallback, current.stream));
1853
+ #else
1723
1854
  if(!_dispatcher) // Optimization, call dispatch() directly if there's no dispatcher.
1724
1855
  {
1725
1856
  dispatch(startCB, sentCBs, compress, requestId, invokeNum, servantManager, adapter, outAsync, heartbeatCallback,
@@ -1727,17 +1858,19 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1727
1858
  }
1728
1859
  else
1729
1860
  {
1730
- _threadPool->dispatchFromThisThread(new DispatchCall(this, startCB, sentCBs, compress, requestId, invokeNum,
1731
- servantManager, adapter, outAsync, heartbeatCallback,
1732
- current.stream));
1861
+ _threadPool->dispatchFromThisThread(new DispatchCall(ICE_SHARED_FROM_THIS, startCB, sentCBs, compress, requestId,
1862
+ invokeNum, servantManager, adapter, outAsync,
1863
+ heartbeatCallback, current.stream));
1864
+
1733
1865
  }
1866
+ #endif
1734
1867
  }
1735
1868
 
1736
1869
  void
1737
1870
  ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingMessage>& sentCBs,
1738
1871
  Byte compress, Int requestId, Int invokeNum, const ServantManagerPtr& servantManager,
1739
1872
  const ObjectAdapterPtr& adapter, const OutgoingAsyncBasePtr& outAsync,
1740
- const ConnectionCallbackPtr& heartbeatCallback, BasicStream& stream)
1873
+ const ICE_DELEGATE(HeartbeatCallback)& heartbeatCallback, InputStream& stream)
1741
1874
  {
1742
1875
  int dispatchedCount = 0;
1743
1876
 
@@ -1747,7 +1880,7 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector
1747
1880
  //
1748
1881
  if(startCB)
1749
1882
  {
1750
- startCB->connectionStartCompleted(this);
1883
+ startCB->connectionStartCompleted(ICE_SHARED_FROM_THIS);
1751
1884
  ++dispatchedCount;
1752
1885
  }
1753
1886
 
@@ -1758,17 +1891,17 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector
1758
1891
  {
1759
1892
  for(vector<OutgoingMessage>::const_iterator p = sentCBs.begin(); p != sentCBs.end(); ++p)
1760
1893
  {
1761
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
1894
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
1762
1895
  if(p->invokeSent)
1763
1896
  {
1764
1897
  p->outAsync->invokeSent();
1765
1898
  }
1766
1899
  if(p->receivedReply)
1767
1900
  {
1768
- OutgoingAsyncPtr outAsync = OutgoingAsyncPtr::dynamicCast(p->outAsync);
1769
- if(outAsync->completed())
1901
+ OutgoingAsyncPtr o = ICE_DYNAMIC_CAST(OutgoingAsync, p->outAsync);
1902
+ if(o->response())
1770
1903
  {
1771
- outAsync->invokeCompleted();
1904
+ o->invokeResponse();
1772
1905
  }
1773
1906
  }
1774
1907
  #else
@@ -1784,7 +1917,7 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector
1784
1917
  //
1785
1918
  if(outAsync)
1786
1919
  {
1787
- outAsync->invokeCompleted();
1920
+ outAsync->invokeResponse();
1788
1921
  ++dispatchedCount;
1789
1922
  }
1790
1923
 
@@ -1792,7 +1925,11 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector
1792
1925
  {
1793
1926
  try
1794
1927
  {
1795
- heartbeatCallback->heartbeat(this);
1928
+ #ifdef ICE_CPP11_MAPPING
1929
+ heartbeatCallback(ICE_SHARED_FROM_THIS);
1930
+ #else
1931
+ heartbeatCallback->heartbeat(ICE_SHARED_FROM_THIS);
1932
+ #endif
1796
1933
  }
1797
1934
  catch(const std::exception& ex)
1798
1935
  {
@@ -1871,21 +2008,27 @@ Ice::ConnectionI::finished(ThreadPoolCurrent& current, bool close)
1871
2008
  // to call code that will potentially block (this avoids promoting a new leader and
1872
2009
  // unecessary thread creation, especially if this is called on shutdown).
1873
2010
  //
1874
- if(!_startCallback && _sendStreams.empty() && _asyncRequests.empty() && !_callback)
2011
+ if(!_startCallback && _sendStreams.empty() && _asyncRequests.empty() && !_closeCallback && !_heartbeatCallback)
1875
2012
  {
1876
2013
  finish(close);
1877
2014
  return;
1878
2015
  }
1879
2016
 
1880
2017
  current.ioCompleted();
2018
+
2019
+ // dispatchFromThisThread dispatches to the correct DispatchQueue
2020
+ #ifdef ICE_SWIFT
2021
+ _threadPool->dispatchFromThisThread(new FinishCall(ICE_SHARED_FROM_THIS, close));
2022
+ #else
1881
2023
  if(!_dispatcher) // Optimization, call finish() directly if there's no dispatcher.
1882
2024
  {
1883
2025
  finish(close);
1884
2026
  }
1885
2027
  else
1886
2028
  {
1887
- _threadPool->dispatchFromThisThread(new FinishCall(this, close));
2029
+ _threadPool->dispatchFromThisThread(new FinishCall(ICE_SHARED_FROM_THIS, close));
1888
2030
  }
2031
+ #endif
1889
2032
  }
1890
2033
 
1891
2034
  void
@@ -1897,8 +2040,9 @@ Ice::ConnectionI::finish(bool close)
1897
2040
  {
1898
2041
  string verb = _connector ? "establish" : "accept";
1899
2042
  Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
2043
+
1900
2044
  out << "failed to " << verb << " " << _endpoint->protocol() << " connection\n" << toString()
1901
- << "\n" << *_exception.get();
2045
+ << "\n" << *_exception;
1902
2046
  }
1903
2047
  }
1904
2048
  else
@@ -1908,28 +2052,35 @@ Ice::ConnectionI::finish(bool close)
1908
2052
  Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
1909
2053
  out << "closed " << _endpoint->protocol() << " connection\n" << toString();
1910
2054
 
1911
- //
1912
- // Trace the cause of unexpected connection closures
1913
- //
1914
2055
  if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
1915
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
2056
+ dynamic_cast<const ConnectionManuallyClosedException*>(_exception.get()) ||
1916
2057
  dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
1917
2058
  dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
1918
2059
  dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get())))
1919
2060
  {
1920
- out << "\n" << *_exception.get();
2061
+ out << "\n" << *_exception;
1921
2062
  }
1922
2063
  }
1923
2064
  }
1924
2065
 
1925
2066
  if(close)
1926
2067
  {
1927
- _transceiver->close();
2068
+ try
2069
+ {
2070
+ _transceiver->close();
2071
+ }
2072
+ catch(const Ice::LocalException& ex)
2073
+ {
2074
+ Error out(_logger);
2075
+ out << "unexpected connection exception:\n" << ex << '\n' << _desc;
2076
+ }
1928
2077
  }
1929
2078
 
1930
2079
  if(_startCallback)
1931
2080
  {
1932
- _startCallback->connectionStartFailed(this, *_exception.get());
2081
+ assert(_exception);
2082
+
2083
+ _startCallback->connectionStartFailed(ICE_SHARED_FROM_THIS, *_exception);
1933
2084
  _startCallback = 0;
1934
2085
  }
1935
2086
 
@@ -1944,7 +2095,7 @@ Ice::ConnectionI::finish(bool close)
1944
2095
  OutgoingMessage* message = &_sendStreams.front();
1945
2096
  _writeStream.swap(*message->stream);
1946
2097
 
1947
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
2098
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
1948
2099
  //
1949
2100
  // The current message might be sent but not yet removed from _sendStreams. If
1950
2101
  // the response has been received in the meantime, we remove the message from
@@ -1958,10 +2109,10 @@ Ice::ConnectionI::finish(bool close)
1958
2109
  }
1959
2110
  if(message->receivedReply)
1960
2111
  {
1961
- OutgoingAsyncPtr outAsync = OutgoingAsyncPtr::dynamicCast(message->outAsync);
1962
- if(outAsync->completed())
2112
+ OutgoingAsyncPtr outAsync = ICE_DYNAMIC_CAST(OutgoingAsync, message->outAsync);
2113
+ if(outAsync->response())
1963
2114
  {
1964
- outAsync->invokeCompleted();
2115
+ outAsync->invokeResponse();
1965
2116
  }
1966
2117
  }
1967
2118
  _sendStreams.pop_front();
@@ -1971,35 +2122,24 @@ Ice::ConnectionI::finish(bool close)
1971
2122
 
1972
2123
  for(deque<OutgoingMessage>::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o)
1973
2124
  {
1974
- o->completed(*_exception.get());
2125
+ o->completed(*_exception);
1975
2126
  if(o->requestId) // Make sure finished isn't called twice.
1976
2127
  {
1977
- if(o->out)
1978
- {
1979
- _requests.erase(o->requestId);
1980
- }
1981
- else
1982
- {
1983
- _asyncRequests.erase(o->requestId);
1984
- }
2128
+ _asyncRequests.erase(o->requestId);
1985
2129
  }
1986
2130
  }
1987
- _sendStreams.clear(); // Must be cleared before _requests because of Outgoing* references in OutgoingMessage
1988
- }
1989
2131
 
1990
- for(map<Int, OutgoingBase*>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
1991
- {
1992
- p->second->completed(*_exception.get());
2132
+ _sendStreams.clear();
1993
2133
  }
1994
- _requests.clear();
1995
2134
 
1996
2135
  for(map<Int, OutgoingAsyncBasePtr>::const_iterator q = _asyncRequests.begin(); q != _asyncRequests.end(); ++q)
1997
2136
  {
1998
- if(q->second->completed(*_exception.get()))
2137
+ if(q->second->exception(*_exception))
1999
2138
  {
2000
- q->second->invokeCompleted();
2139
+ q->second->invokeException();
2001
2140
  }
2002
2141
  }
2142
+
2003
2143
  _asyncRequests.clear();
2004
2144
 
2005
2145
  //
@@ -2010,12 +2150,14 @@ Ice::ConnectionI::finish(bool close)
2010
2150
  _readStream.clear();
2011
2151
  _readStream.b.clear();
2012
2152
 
2013
- if(_callback)
2153
+ if(_closeCallback)
2014
2154
  {
2015
- closeCallback(_callback);
2016
- _callback = 0;
2155
+ closeCallback(_closeCallback);
2156
+ _closeCallback = ICE_NULLPTR;
2017
2157
  }
2018
2158
 
2159
+ _heartbeatCallback = ICE_NULLPTR;
2160
+
2019
2161
  //
2020
2162
  // This must be done last as this will cause waitUntilFinished() to return (and communicator
2021
2163
  // objects such as the timer might be destroyed too).
@@ -2032,7 +2174,7 @@ Ice::ConnectionI::finish(bool close)
2032
2174
  }
2033
2175
 
2034
2176
  string
2035
- Ice::ConnectionI::toString() const
2177
+ Ice::ConnectionI::toString() const ICE_NOEXCEPT
2036
2178
  {
2037
2179
  return _desc; // No mutex lock, _desc is immutable.
2038
2180
  }
@@ -2062,13 +2204,13 @@ Ice::ConnectionI::timedOut()
2062
2204
  }
2063
2205
 
2064
2206
  string
2065
- Ice::ConnectionI::type() const
2207
+ Ice::ConnectionI::type() const ICE_NOEXCEPT
2066
2208
  {
2067
2209
  return _type; // No mutex lock, _type is immutable.
2068
2210
  }
2069
2211
 
2070
2212
  Ice::Int
2071
- Ice::ConnectionI::timeout() const
2213
+ Ice::ConnectionI::timeout() const ICE_NOEXCEPT
2072
2214
  {
2073
2215
  return _endpoint->timeout(); // No mutex lock, _endpoint is immutable.
2074
2216
  }
@@ -2131,7 +2273,6 @@ Ice::ConnectionI::ConnectionI(const CommunicatorPtr& communicator,
2131
2273
  _warnUdp(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0),
2132
2274
  _compressionLevel(1),
2133
2275
  _nextRequestId(1),
2134
- _requestsHint(_requests.end()),
2135
2276
  _asyncRequestsHint(_asyncRequests.end()),
2136
2277
  _messageSizeMax(adapter ? adapter->messageSizeMax() : _instance->messageSizeMax()),
2137
2278
  _batchRequestQueue(new BatchRequestQueue(instance, endpoint->datagram())),
@@ -2166,36 +2307,39 @@ Ice::ConnectionI::ConnectionI(const CommunicatorPtr& communicator,
2166
2307
  {
2167
2308
  _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
2168
2309
  }
2310
+ }
2169
2311
 
2170
- __setNoDelete(true);
2171
- try
2312
+ Ice::ConnectionIPtr
2313
+ Ice::ConnectionI::create(const CommunicatorPtr& communicator,
2314
+ const InstancePtr& instance,
2315
+ const ACMMonitorPtr& monitor,
2316
+ const TransceiverPtr& transceiver,
2317
+ const ConnectorPtr& connector,
2318
+ const EndpointIPtr& endpoint,
2319
+ const ObjectAdapterIPtr& adapter)
2320
+ {
2321
+ Ice::ConnectionIPtr conn(new ConnectionI(communicator, instance, monitor, transceiver, connector,
2322
+ endpoint, adapter));
2323
+ if(adapter)
2172
2324
  {
2173
- if(adapter)
2174
- {
2175
- const_cast<ThreadPoolPtr&>(_threadPool) = adapter->getThreadPool();
2176
- }
2177
- else
2178
- {
2179
- const_cast<ThreadPoolPtr&>(_threadPool) = _instance->clientThreadPool();
2180
- }
2181
- _threadPool->initialize(this);
2325
+ const_cast<ThreadPoolPtr&>(conn->_threadPool) = adapter->getThreadPool();
2182
2326
  }
2183
- catch(const IceUtil::Exception&)
2327
+ else
2184
2328
  {
2185
- __setNoDelete(false);
2186
- throw;
2329
+ const_cast<ThreadPoolPtr&>(conn->_threadPool) = conn->_instance->clientThreadPool();
2187
2330
  }
2188
- __setNoDelete(false);
2331
+ conn->_threadPool->initialize(conn);
2332
+ return conn;
2189
2333
  }
2190
2334
 
2191
2335
  Ice::ConnectionI::~ConnectionI()
2192
2336
  {
2193
2337
  assert(!_startCallback);
2194
- assert(!_callback);
2338
+ assert(!_closeCallback);
2339
+ assert(!_heartbeatCallback);
2195
2340
  assert(_state == StateFinished);
2196
2341
  assert(_dispatchCount == 0);
2197
2342
  assert(_sendStreams.empty());
2198
- assert(_requests.empty());
2199
2343
  assert(_asyncRequests.empty());
2200
2344
  }
2201
2345
 
@@ -2213,15 +2357,13 @@ Ice::ConnectionI::setState(State state, const LocalException& ex)
2213
2357
  return;
2214
2358
  }
2215
2359
 
2216
- if(!_exception.get())
2360
+ if(!_exception)
2217
2361
  {
2218
2362
  //
2219
2363
  // If we are in closed state, an exception must be set.
2220
2364
  //
2221
2365
  assert(_state != StateClosed);
2222
-
2223
- _exception.reset(ex.ice_clone());
2224
-
2366
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
2225
2367
  //
2226
2368
  // We don't warn if we are not validated.
2227
2369
  //
@@ -2230,15 +2372,15 @@ Ice::ConnectionI::setState(State state, const LocalException& ex)
2230
2372
  //
2231
2373
  // Don't warn about certain expected exceptions.
2232
2374
  //
2233
- if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
2234
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
2235
- dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
2236
- dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
2237
- dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
2238
- (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state >= StateClosing)))
2375
+ if(!(dynamic_cast<const CloseConnectionException*>(&ex) ||
2376
+ dynamic_cast<const ConnectionManuallyClosedException*>(&ex) ||
2377
+ dynamic_cast<const ConnectionTimeoutException*>(&ex) ||
2378
+ dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
2379
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) ||
2380
+ (dynamic_cast<const ConnectionLostException*>(&ex) && _state >= StateClosing)))
2239
2381
  {
2240
2382
  Warning out(_logger);
2241
- out << "connection exception:\n" << *_exception.get() << '\n' << _desc;
2383
+ out << "connection exception:\n" << ex << '\n' << _desc;
2242
2384
  }
2243
2385
  }
2244
2386
  }
@@ -2280,92 +2422,92 @@ Ice::ConnectionI::setState(State state)
2280
2422
  {
2281
2423
  switch(state)
2282
2424
  {
2283
- case StateNotInitialized:
2284
- {
2285
- assert(false);
2286
- break;
2287
- }
2288
-
2289
- case StateNotValidated:
2290
- {
2291
- if(_state != StateNotInitialized)
2425
+ case StateNotInitialized:
2292
2426
  {
2293
- assert(_state == StateClosed);
2294
- return;
2427
+ assert(false);
2428
+ break;
2295
2429
  }
2296
- break;
2297
- }
2298
2430
 
2299
- case StateActive:
2300
- {
2301
- //
2302
- // Can only switch from holding or not validated to
2303
- // active.
2304
- //
2305
- if(_state != StateHolding && _state != StateNotValidated)
2431
+ case StateNotValidated:
2306
2432
  {
2307
- return;
2433
+ if(_state != StateNotInitialized)
2434
+ {
2435
+ assert(_state == StateClosed);
2436
+ return;
2437
+ }
2438
+ break;
2308
2439
  }
2309
- _threadPool->_register(this, SocketOperationRead);
2310
- break;
2311
- }
2312
2440
 
2313
- case StateHolding:
2314
- {
2315
- //
2316
- // Can only switch from active or not validated to
2317
- // holding.
2318
- //
2319
- if(_state != StateActive && _state != StateNotValidated)
2441
+ case StateActive:
2320
2442
  {
2321
- return;
2443
+ //
2444
+ // Can only switch from holding or not validated to
2445
+ // active.
2446
+ //
2447
+ if(_state != StateHolding && _state != StateNotValidated)
2448
+ {
2449
+ return;
2450
+ }
2451
+ _threadPool->_register(ICE_SHARED_FROM_THIS, SocketOperationRead);
2452
+ break;
2322
2453
  }
2323
- if(_state == StateActive)
2454
+
2455
+ case StateHolding:
2324
2456
  {
2325
- _threadPool->unregister(this, SocketOperationRead);
2457
+ //
2458
+ // Can only switch from active or not validated to
2459
+ // holding.
2460
+ //
2461
+ if(_state != StateActive && _state != StateNotValidated)
2462
+ {
2463
+ return;
2464
+ }
2465
+ if(_state == StateActive)
2466
+ {
2467
+ _threadPool->unregister(ICE_SHARED_FROM_THIS, SocketOperationRead);
2468
+ }
2469
+ break;
2326
2470
  }
2327
- break;
2328
- }
2329
2471
 
2330
- case StateClosing:
2331
- case StateClosingPending:
2332
- {
2333
- //
2334
- // Can't change back from closing pending.
2335
- //
2336
- if(_state >= StateClosingPending)
2472
+ case StateClosing:
2473
+ case StateClosingPending:
2337
2474
  {
2338
- return;
2475
+ //
2476
+ // Can't change back from closing pending.
2477
+ //
2478
+ if(_state >= StateClosingPending)
2479
+ {
2480
+ return;
2481
+ }
2482
+ break;
2339
2483
  }
2340
- break;
2341
- }
2342
2484
 
2343
- case StateClosed:
2344
- {
2345
- if(_state == StateFinished)
2485
+ case StateClosed:
2346
2486
  {
2347
- return;
2348
- }
2487
+ if(_state == StateFinished)
2488
+ {
2489
+ return;
2490
+ }
2349
2491
 
2350
- _batchRequestQueue->destroy(*_exception.get());
2492
+ _batchRequestQueue->destroy(*_exception);
2351
2493
 
2352
- //
2353
- // Don't need to close now for connections so only close the transceiver
2354
- // if the selector request it.
2355
- //
2356
- if(_threadPool->finish(this, false))
2357
- {
2358
- _transceiver->close();
2494
+ //
2495
+ // Don't need to close now for connections so only close the transceiver
2496
+ // if the selector request it.
2497
+ //
2498
+ if(_threadPool->finish(ICE_SHARED_FROM_THIS, false))
2499
+ {
2500
+ _transceiver->close();
2501
+ }
2502
+ break;
2359
2503
  }
2360
- break;
2361
- }
2362
2504
 
2363
- case StateFinished:
2364
- {
2365
- assert(_state == StateClosed);
2366
- _communicator = 0;
2367
- break;
2368
- }
2505
+ case StateFinished:
2506
+ {
2507
+ assert(_state == StateClosed);
2508
+ _communicator = 0;
2509
+ break;
2510
+ }
2369
2511
  }
2370
2512
  }
2371
2513
  catch(const Ice::LocalException& ex)
@@ -2388,11 +2530,11 @@ Ice::ConnectionI::setState(State state)
2388
2530
  {
2389
2531
  _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
2390
2532
  }
2391
- _monitor->add(this);
2533
+ _monitor->add(ICE_SHARED_FROM_THIS);
2392
2534
  }
2393
2535
  else if(_state == StateActive)
2394
2536
  {
2395
- _monitor->remove(this);
2537
+ _monitor->remove(ICE_SHARED_FROM_THIS);
2396
2538
  }
2397
2539
  }
2398
2540
 
@@ -2407,16 +2549,16 @@ Ice::ConnectionI::setState(State state)
2407
2549
  newState,
2408
2550
  _observer.get()));
2409
2551
  }
2410
- if(_observer && state == StateClosed && _exception.get())
2552
+ if(_observer && state == StateClosed && _exception)
2411
2553
  {
2412
2554
  if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
2413
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
2555
+ dynamic_cast<const ConnectionManuallyClosedException*>(_exception.get()) ||
2414
2556
  dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
2415
2557
  dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
2416
2558
  dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
2417
2559
  (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state >= StateClosing)))
2418
2560
  {
2419
- _observer->failed(_exception->ice_name());
2561
+ _observer->failed(_exception->ice_id());
2420
2562
  }
2421
2563
  }
2422
2564
  }
@@ -2440,8 +2582,7 @@ Ice::ConnectionI::setState(State state)
2440
2582
  void
2441
2583
  Ice::ConnectionI::initiateShutdown()
2442
2584
  {
2443
- assert(_state == StateClosing);
2444
- assert(_dispatchCount == 0);
2585
+ assert(_state == StateClosing && _dispatchCount == 0);
2445
2586
 
2446
2587
  if(_shutdownInitiated)
2447
2588
  {
@@ -2454,7 +2595,7 @@ Ice::ConnectionI::initiateShutdown()
2454
2595
  //
2455
2596
  // Before we shut down, we send a close connection message.
2456
2597
  //
2457
- BasicStream os(_instance.get(), Ice::currentProtocolEncoding);
2598
+ OutputStream os(_instance.get(), Ice::currentProtocolEncoding);
2458
2599
  os.write(magic[0]);
2459
2600
  os.write(magic[1]);
2460
2601
  os.write(magic[2]);
@@ -2471,26 +2612,26 @@ Ice::ConnectionI::initiateShutdown()
2471
2612
  setState(StateClosingPending);
2472
2613
 
2473
2614
  //
2474
- // Notify the the transceiver of the graceful connection closure.
2615
+ // Notify the transceiver of the graceful connection closure.
2475
2616
  //
2476
- SocketOperation op = _transceiver->closing(true, *_exception.get());
2617
+ SocketOperation op = _transceiver->closing(true, *_exception);
2477
2618
  if(op)
2478
2619
  {
2479
2620
  scheduleTimeout(op);
2480
- _threadPool->_register(this, op);
2621
+ _threadPool->_register(ICE_SHARED_FROM_THIS, op);
2481
2622
  }
2482
2623
  }
2483
2624
  }
2484
2625
  }
2485
2626
 
2486
2627
  void
2487
- Ice::ConnectionI::heartbeat()
2628
+ Ice::ConnectionI::sendHeartbeatNow()
2488
2629
  {
2489
2630
  assert(_state == StateActive);
2490
2631
 
2491
2632
  if(!_endpoint->datagram())
2492
2633
  {
2493
- BasicStream os(_instance.get(), Ice::currentProtocolEncoding);
2634
+ OutputStream os(_instance.get(), Ice::currentProtocolEncoding);
2494
2635
  os.write(magic[0]);
2495
2636
  os.write(magic[1]);
2496
2637
  os.write(magic[2]);
@@ -2509,7 +2650,7 @@ Ice::ConnectionI::heartbeat()
2509
2650
  catch(const LocalException& ex)
2510
2651
  {
2511
2652
  setState(StateClosed, ex);
2512
- assert(_exception.get());
2653
+ assert(_exception);
2513
2654
  }
2514
2655
  }
2515
2656
  }
@@ -2517,11 +2658,11 @@ Ice::ConnectionI::heartbeat()
2517
2658
  bool
2518
2659
  Ice::ConnectionI::initialize(SocketOperation operation)
2519
2660
  {
2520
- SocketOperation s = _transceiver->initialize(_readStream, _writeStream, _hasMoreData);
2661
+ SocketOperation s = _transceiver->initialize(_readStream, _writeStream);
2521
2662
  if(s != SocketOperationNone)
2522
2663
  {
2523
2664
  scheduleTimeout(s);
2524
- _threadPool->update(this, operation, s);
2665
+ _threadPool->update(ICE_SHARED_FROM_THIS, operation, s);
2525
2666
  return false;
2526
2667
  }
2527
2668
 
@@ -2567,7 +2708,7 @@ Ice::ConnectionI::validate(SocketOperation operation)
2567
2708
  if(op)
2568
2709
  {
2569
2710
  scheduleTimeout(op);
2570
- _threadPool->update(this, operation, op);
2711
+ _threadPool->update(ICE_SHARED_FROM_THIS, operation, op);
2571
2712
  return false;
2572
2713
  }
2573
2714
  }
@@ -2596,7 +2737,7 @@ Ice::ConnectionI::validate(SocketOperation operation)
2596
2737
  if(op)
2597
2738
  {
2598
2739
  scheduleTimeout(op);
2599
- _threadPool->update(this, operation, op);
2740
+ _threadPool->update(ICE_SHARED_FROM_THIS, operation, op);
2600
2741
  return false;
2601
2742
  }
2602
2743
  }
@@ -2606,6 +2747,8 @@ Ice::ConnectionI::validate(SocketOperation operation)
2606
2747
  _observer.finishRead(_readStream);
2607
2748
  }
2608
2749
 
2750
+ _validated = true;
2751
+
2609
2752
  assert(_readStream.i == _readStream.b.end());
2610
2753
  _readStream.i = _readStream.b.begin();
2611
2754
  Byte m[4];
@@ -2615,9 +2758,7 @@ Ice::ConnectionI::validate(SocketOperation operation)
2615
2758
  _readStream.read(m[3]);
2616
2759
  if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
2617
2760
  {
2618
- BadMagicException ex(__FILE__, __LINE__);
2619
- ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic));
2620
- throw ex;
2761
+ throw BadMagicException(__FILE__, __LINE__, "", Ice::ByteSeq(&m[0], &m[0] + sizeof(magic)));
2621
2762
  }
2622
2763
  ProtocolVersion pv;
2623
2764
  _readStream.read(pv);
@@ -2640,8 +2781,6 @@ Ice::ConnectionI::validate(SocketOperation operation)
2640
2781
  throw IllegalMessageSizeException(__FILE__, __LINE__);
2641
2782
  }
2642
2783
  traceRecv(_readStream, _logger, _traceLevels);
2643
-
2644
- _validated = true;
2645
2784
  }
2646
2785
  }
2647
2786
 
@@ -2740,17 +2879,10 @@ Ice::ConnectionI::sendNextMessage(vector& callbacks)
2740
2879
  //
2741
2880
  // Do compression.
2742
2881
  //
2743
- BasicStream stream(_instance.get(), Ice::currentProtocolEncoding);
2882
+ OutputStream stream(_instance.get(), Ice::currentProtocolEncoding);
2744
2883
  doCompress(*message->stream, stream);
2745
2884
 
2746
- if(message->outAsync)
2747
- {
2748
- trace("sending asynchronous request", *message->stream, _logger, _traceLevels);
2749
- }
2750
- else
2751
- {
2752
- traceSend(*message->stream, _logger, _traceLevels);
2753
- }
2885
+ traceSend(*message->stream, _logger, _traceLevels);
2754
2886
 
2755
2887
  message->adopt(&stream); // Adopt the compressed stream.
2756
2888
  message->stream->i = message->stream->b.begin();
@@ -2777,14 +2909,8 @@ Ice::ConnectionI::sendNextMessage(vector& callbacks)
2777
2909
  copy(p, p + sizeof(Int), message->stream->b.begin() + 10);
2778
2910
  #endif
2779
2911
  message->stream->i = message->stream->b.begin();
2780
- if(message->outAsync)
2781
- {
2782
- trace("sending asynchronous request", *message->stream, _logger, _traceLevels);
2783
- }
2784
- else
2785
- {
2786
- traceSend(*message->stream, _logger, _traceLevels);
2787
- }
2912
+ traceSend(*message->stream, _logger, _traceLevels);
2913
+
2788
2914
  #ifdef ICE_HAS_BZIP2
2789
2915
  }
2790
2916
  #endif
@@ -2819,7 +2945,7 @@ Ice::ConnectionI::sendNextMessage(vector& callbacks)
2819
2945
  if(_state == StateClosing && _shutdownInitiated)
2820
2946
  {
2821
2947
  setState(StateClosingPending);
2822
- SocketOperation op = _transceiver->closing(true, *_exception.get());
2948
+ SocketOperation op = _transceiver->closing(true, *_exception);
2823
2949
  if(op)
2824
2950
  {
2825
2951
  return op;
@@ -2865,18 +2991,11 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2865
2991
  //
2866
2992
  // Do compression.
2867
2993
  //
2868
- BasicStream stream(_instance.get(), Ice::currentProtocolEncoding);
2994
+ OutputStream stream(_instance.get(), Ice::currentProtocolEncoding);
2869
2995
  doCompress(*message.stream, stream);
2870
2996
  stream.i = stream.b.begin();
2871
2997
 
2872
- if(message.outAsync)
2873
- {
2874
- trace("sending asynchronous request", *message.stream, _logger, _traceLevels);
2875
- }
2876
- else
2877
- {
2878
- traceSend(*message.stream, _logger, _traceLevels);
2879
- }
2998
+ traceSend(*message.stream, _logger, _traceLevels);
2880
2999
 
2881
3000
  //
2882
3001
  // Send the message without blocking.
@@ -2931,14 +3050,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2931
3050
  #endif
2932
3051
  message.stream->i = message.stream->b.begin();
2933
3052
 
2934
- if(message.outAsync)
2935
- {
2936
- trace("sending asynchronous request", *message.stream, _logger, _traceLevels);
2937
- }
2938
- else
2939
- {
2940
- traceSend(*message.stream, _logger, _traceLevels);
2941
- }
3053
+ traceSend(*message.stream, _logger, _traceLevels);
2942
3054
 
2943
3055
  //
2944
3056
  // Send the message without blocking.
@@ -2974,7 +3086,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2974
3086
 
2975
3087
  _writeStream.swap(*_sendStreams.back().stream);
2976
3088
  scheduleTimeout(op);
2977
- _threadPool->_register(this, op);
3089
+ _threadPool->_register(ICE_SHARED_FROM_THIS, op);
2978
3090
  return AsyncStatusQueued;
2979
3091
  }
2980
3092
 
@@ -3041,7 +3153,7 @@ getBZ2Error(int bzError)
3041
3153
  }
3042
3154
 
3043
3155
  void
3044
- Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed)
3156
+ Ice::ConnectionI::doCompress(OutputStream& uncompressed, OutputStream& compressed)
3045
3157
  {
3046
3158
  const Byte* p;
3047
3159
 
@@ -3058,9 +3170,7 @@ Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed)
3058
3170
  _compressionLevel, 0, 0);
3059
3171
  if(bzError != BZ_OK)
3060
3172
  {
3061
- CompressionException ex(__FILE__, __LINE__);
3062
- ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError);
3063
- throw ex;
3173
+ throw CompressionException(__FILE__, __LINE__, "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError));
3064
3174
  }
3065
3175
  compressed.b.resize(headerSize + sizeof(Int) + compressedLen);
3066
3176
 
@@ -3096,7 +3206,7 @@ Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed)
3096
3206
  }
3097
3207
 
3098
3208
  void
3099
- Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompressed)
3209
+ Ice::ConnectionI::doUncompress(InputStream& compressed, InputStream& uncompressed)
3100
3210
  {
3101
3211
  Int uncompressedSize;
3102
3212
  compressed.i = compressed.b.begin() + headerSize;
@@ -3108,11 +3218,11 @@ Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompresse
3108
3218
 
3109
3219
  if(uncompressedSize > static_cast<Int>(_messageSizeMax))
3110
3220
  {
3111
- Ex::throwMemoryLimitException(__FILE__, __LINE__, uncompressedSize, _messageSizeMax);
3221
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, static_cast<size_t>(uncompressedSize), _messageSizeMax);
3112
3222
  }
3113
- uncompressed.resize(uncompressedSize);
3223
+ uncompressed.resize(static_cast<size_t>(uncompressedSize));
3114
3224
 
3115
- unsigned int uncompressedLen = uncompressedSize - headerSize;
3225
+ unsigned int uncompressedLen = static_cast<unsigned int>(uncompressedSize - headerSize);
3116
3226
  unsigned int compressedLen = static_cast<unsigned int>(compressed.b.size() - headerSize - sizeof(Int));
3117
3227
  int bzError = BZ2_bzBuffToBuffDecompress(reinterpret_cast<char*>(&uncompressed.b[0]) + headerSize,
3118
3228
  &uncompressedLen,
@@ -3121,9 +3231,7 @@ Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompresse
3121
3231
  0, 0);
3122
3232
  if(bzError != BZ_OK)
3123
3233
  {
3124
- CompressionException ex(__FILE__, __LINE__);
3125
- ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError);
3126
- throw ex;
3234
+ throw CompressionException(__FILE__, __LINE__, "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError));
3127
3235
  }
3128
3236
 
3129
3237
  copy(compressed.b.begin(), compressed.b.begin() + headerSize, uncompressed.b.begin());
@@ -3131,9 +3239,9 @@ Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompresse
3131
3239
  #endif
3132
3240
 
3133
3241
  SocketOperation
3134
- Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& requestId, Byte& compress,
3242
+ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& requestId, Byte& compress,
3135
3243
  ServantManagerPtr& servantManager, ObjectAdapterPtr& adapter,
3136
- OutgoingAsyncBasePtr& outAsync, ConnectionCallbackPtr& heartbeatCallback,
3244
+ OutgoingAsyncBasePtr& outAsync, ICE_DELEGATE(HeartbeatCallback)& heartbeatCallback,
3137
3245
  int& dispatchCount)
3138
3246
  {
3139
3247
  assert(_state > StateNotValidated && _state < StateClosed);
@@ -3145,14 +3253,6 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3145
3253
 
3146
3254
  assert(stream.i == stream.b.end());
3147
3255
 
3148
- //
3149
- // Connection is validated on first message. This is only used by
3150
- // setState() to check wether or not we can print a connection
3151
- // warning (a client might close the connection forcefully if the
3152
- // connection isn't validated).
3153
- //
3154
- _validated = true;
3155
-
3156
3256
  try
3157
3257
  {
3158
3258
  //
@@ -3169,13 +3269,11 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3169
3269
  if(compress == 2)
3170
3270
  {
3171
3271
  #ifdef ICE_HAS_BZIP2
3172
- BasicStream ustream(_instance.get(), Ice::currentProtocolEncoding);
3272
+ InputStream ustream(_instance.get(), Ice::currentProtocolEncoding);
3173
3273
  doUncompress(stream, ustream);
3174
3274
  stream.b.swap(ustream.b);
3175
3275
  #else
3176
- FeatureNotSupportedException ex(__FILE__, __LINE__);
3177
- ex.unsupportedFeature = "Cannot uncompress compressed message";
3178
- throw ex;
3276
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "Cannot uncompress compressed message");
3179
3277
  #endif
3180
3278
  }
3181
3279
  stream.i = stream.b.begin() + headerSize;
@@ -3198,9 +3296,9 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3198
3296
  setState(StateClosingPending, CloseConnectionException(__FILE__, __LINE__));
3199
3297
 
3200
3298
  //
3201
- // Notify the the transceiver of the graceful connection closure.
3299
+ // Notify the transceiver of the graceful connection closure.
3202
3300
  //
3203
- SocketOperation op = _transceiver->closing(false, *_exception.get());
3301
+ SocketOperation op = _transceiver->closing(false, *_exception);
3204
3302
  if(op)
3205
3303
  {
3206
3304
  return op;
@@ -3258,54 +3356,22 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3258
3356
 
3259
3357
  stream.read(requestId);
3260
3358
 
3261
- map<Int, OutgoingBase*>::iterator p = _requests.end();
3262
3359
  map<Int, OutgoingAsyncBasePtr>::iterator q = _asyncRequests.end();
3263
3360
 
3264
- if(_requestsHint != _requests.end())
3265
- {
3266
- if(_requestsHint->first == requestId)
3267
- {
3268
- p = _requestsHint;
3269
- }
3270
- }
3271
-
3272
- if(p == _requests.end())
3361
+ if(_asyncRequestsHint != _asyncRequests.end())
3273
3362
  {
3274
- if(_asyncRequestsHint != _asyncRequests.end())
3363
+ if(_asyncRequestsHint->first == requestId)
3275
3364
  {
3276
- if(_asyncRequestsHint->first == requestId)
3277
- {
3278
- q = _asyncRequestsHint;
3279
- }
3365
+ q = _asyncRequestsHint;
3280
3366
  }
3281
3367
  }
3282
3368
 
3283
- if(p == _requests.end() && q == _asyncRequests.end())
3284
- {
3285
- p = _requests.find(requestId);
3286
- }
3287
-
3288
- if(p == _requests.end() && q == _asyncRequests.end())
3369
+ if(q == _asyncRequests.end())
3289
3370
  {
3290
3371
  q = _asyncRequests.find(requestId);
3291
3372
  }
3292
3373
 
3293
- if(p != _requests.end())
3294
- {
3295
- p->second->completed(stream);
3296
-
3297
- if(p == _requestsHint)
3298
- {
3299
- _requests.erase(p++);
3300
- _requestsHint = p;
3301
- }
3302
- else
3303
- {
3304
- _requests.erase(p);
3305
- }
3306
- notifyAll(); // Notify threads blocked in close(false)
3307
- }
3308
- else if(q != _asyncRequests.end())
3374
+ if(q != _asyncRequests.end())
3309
3375
  {
3310
3376
  outAsync = q->second;
3311
3377
 
@@ -3321,7 +3387,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3321
3387
 
3322
3388
  stream.swap(*outAsync->getIs());
3323
3389
 
3324
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
3390
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
3325
3391
  //
3326
3392
  // If we just received the reply of a request which isn't acknowledge as
3327
3393
  // sent yet, we queue the reply instead of processing it right away. It
@@ -3333,7 +3399,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3333
3399
  message->receivedReply = true;
3334
3400
  outAsync = 0;
3335
3401
  }
3336
- else if(outAsync->completed())
3402
+ else if(outAsync->response())
3337
3403
  {
3338
3404
  ++dispatchCount;
3339
3405
  }
@@ -3342,7 +3408,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3342
3408
  outAsync = 0;
3343
3409
  }
3344
3410
  #else
3345
- if(outAsync->completed())
3411
+ if(outAsync->response())
3346
3412
  {
3347
3413
  ++dispatchCount;
3348
3414
  }
@@ -3360,9 +3426,9 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3360
3426
  case validateConnectionMsg:
3361
3427
  {
3362
3428
  traceRecv(stream, _logger, _traceLevels);
3363
- if(_callback)
3429
+ if(_heartbeatCallback)
3364
3430
  {
3365
- heartbeatCallback = _callback;
3431
+ heartbeatCallback = _heartbeatCallback;
3366
3432
  ++dispatchCount;
3367
3433
  }
3368
3434
  break;
@@ -3395,7 +3461,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3395
3461
  }
3396
3462
 
3397
3463
  void
3398
- Ice::ConnectionI::invokeAll(BasicStream& stream, Int invokeNum, Int requestId, Byte compress,
3464
+ Ice::ConnectionI::invokeAll(InputStream& stream, Int invokeNum, Int requestId, Byte compress,
3399
3465
  const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter)
3400
3466
  {
3401
3467
  //
@@ -3530,11 +3596,17 @@ Ice::ConnectionI::initConnectionInfo() const
3530
3596
  }
3531
3597
  catch(const Ice::LocalException&)
3532
3598
  {
3533
- _info = new ConnectionInfo();
3599
+ _info = ICE_MAKE_SHARED(ConnectionInfo);
3600
+ }
3601
+
3602
+ Ice::ConnectionInfoPtr info = _info;
3603
+ while(info)
3604
+ {
3605
+ info->connectionId = _endpoint->connectionId();
3606
+ info->incoming = _connector == 0;
3607
+ info->adapterName = _adapter ? _adapter->getName() : string();
3608
+ info = info->underlying;
3534
3609
  }
3535
- _info->connectionId = _endpoint->connectionId();
3536
- _info->incoming = _connector == 0;
3537
- _info->adapterName = _adapter ? _adapter->getName() : string();
3538
3610
  return _info;
3539
3611
  }
3540
3612
 
@@ -3548,7 +3620,7 @@ SocketOperation
3548
3620
  ConnectionI::read(Buffer& buf)
3549
3621
  {
3550
3622
  Buffer::Container::iterator start = buf.i;
3551
- SocketOperation op = _transceiver->read(buf, _hasMoreData);
3623
+ SocketOperation op = _transceiver->read(buf);
3552
3624
  if(_instance->traceLevels()->network >= 3 && buf.i != start)
3553
3625
  {
3554
3626
  Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
@@ -3589,7 +3661,7 @@ ConnectionI::reap()
3589
3661
  {
3590
3662
  if(_monitor)
3591
3663
  {
3592
- _monitor->reap(this);
3664
+ _monitor->reap(ICE_SHARED_FROM_THIS);
3593
3665
  }
3594
3666
  if(_observer)
3595
3667
  {