zeroc-ice 3.6.5 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (752) hide show
  1. checksums.yaml +4 -4
  2. data/BZIP2_LICENSE +42 -0
  3. data/ICE_LICENSE +17 -17
  4. data/LICENSE +12 -12
  5. data/bin/slice2rb +1 -1
  6. data/ext/Communicator.cpp +150 -53
  7. data/ext/Communicator.h +1 -1
  8. data/ext/Config.h +2 -12
  9. data/ext/Connection.cpp +89 -68
  10. data/ext/Connection.h +1 -1
  11. data/ext/Endpoint.cpp +16 -45
  12. data/ext/Endpoint.h +1 -1
  13. data/ext/ImplicitContext.cpp +1 -5
  14. data/ext/ImplicitContext.h +1 -1
  15. data/ext/Init.cpp +4 -1
  16. data/ext/Logger.cpp +1 -1
  17. data/ext/Logger.h +1 -1
  18. data/ext/Operation.cpp +33 -44
  19. data/ext/Operation.h +1 -1
  20. data/ext/Properties.cpp +1 -1
  21. data/ext/Properties.h +1 -1
  22. data/ext/Proxy.cpp +22 -57
  23. data/ext/Proxy.h +1 -1
  24. data/ext/Slice.cpp +5 -5
  25. data/ext/Slice.h +1 -1
  26. data/ext/Types.cpp +244 -171
  27. data/ext/Types.h +118 -66
  28. data/ext/Util.cpp +13 -9
  29. data/ext/Util.h +10 -10
  30. data/ext/ValueFactoryManager.cpp +445 -0
  31. data/ext/ValueFactoryManager.h +100 -0
  32. data/ext/extconf.rb +47 -45
  33. data/ext/ice/bzip2/blocksort.c +1094 -0
  34. data/ext/ice/bzip2/bzlib.c +1572 -0
  35. data/ext/ice/bzip2/bzlib.h +282 -0
  36. data/ext/ice/bzip2/bzlib_private.h +509 -0
  37. data/ext/ice/bzip2/compress.c +672 -0
  38. data/ext/ice/bzip2/crctable.c +104 -0
  39. data/ext/ice/bzip2/decompress.c +646 -0
  40. data/ext/ice/bzip2/huffman.c +205 -0
  41. data/ext/ice/bzip2/randtable.c +84 -0
  42. data/ext/ice/cpp/include/Ice/Application.h +77 -60
  43. data/ext/ice/cpp/include/Ice/AsyncResult.h +34 -318
  44. data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -2
  45. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +5 -10
  46. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -1
  47. data/ext/ice/cpp/include/Ice/Buffer.h +10 -10
  48. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +14 -12
  49. data/ext/ice/cpp/include/Ice/Comparable.h +130 -0
  50. data/ext/ice/cpp/include/Ice/Config.h +7 -36
  51. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +107 -11
  52. data/ext/ice/cpp/include/Ice/ConnectionIF.h +5 -1
  53. data/ext/ice/cpp/include/Ice/ConsoleUtil.h +28 -0
  54. data/ext/ice/cpp/include/Ice/{DefaultObjectFactory.h → DefaultValueFactory.h} +28 -14
  55. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +4 -6
  56. data/ext/ice/cpp/include/Ice/Dispatcher.h +14 -13
  57. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -5
  58. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -1
  59. data/ext/ice/cpp/include/Ice/Exception.h +66 -56
  60. data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +69 -0
  61. data/ext/ice/cpp/include/Ice/FactoryTable.h +11 -12
  62. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +27 -25
  63. data/ext/ice/cpp/include/Ice/Format.h +6 -1
  64. data/ext/ice/cpp/include/Ice/Functional.h +33 -33
  65. data/ext/ice/cpp/include/Ice/GCObject.h +9 -5
  66. data/ext/ice/cpp/include/Ice/Handle.h +6 -11
  67. data/ext/ice/cpp/include/Ice/Ice.h +9 -5
  68. data/ext/ice/cpp/include/{IceUtil → Ice}/IconvStringConverter.h +108 -62
  69. data/ext/ice/cpp/include/Ice/Incoming.h +109 -33
  70. data/ext/ice/cpp/include/Ice/IncomingAsync.h +63 -23
  71. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -1
  72. data/ext/ice/cpp/include/Ice/Initialize.h +178 -38
  73. data/ext/ice/cpp/include/Ice/InputStream.h +994 -0
  74. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -2
  75. data/ext/ice/cpp/include/Ice/InterfaceByValue.h +46 -0
  76. data/ext/ice/cpp/include/Ice/LocalObject.h +9 -9
  77. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -1
  78. data/ext/ice/cpp/include/Ice/LoggerUtil.h +20 -14
  79. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +114 -65
  80. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +23 -5
  81. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +99 -26
  82. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +17 -4
  83. data/ext/ice/cpp/include/Ice/Object.h +105 -56
  84. data/ext/ice/cpp/include/Ice/ObjectF.h +8 -3
  85. data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -8
  86. data/ext/ice/cpp/include/Ice/Optional.h +1084 -0
  87. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +655 -84
  88. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -6
  89. data/ext/ice/cpp/include/Ice/OutputStream.h +753 -0
  90. data/ext/ice/cpp/include/Ice/Protocol.h +19 -12
  91. data/ext/ice/cpp/include/Ice/Proxy.h +1329 -717
  92. data/ext/ice/cpp/include/Ice/ProxyF.h +11 -33
  93. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -1
  94. data/ext/ice/cpp/include/Ice/ProxyHandle.h +34 -50
  95. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -1
  96. data/ext/ice/cpp/include/Ice/RegisterPlugins.h +22 -3
  97. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -4
  98. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -1
  99. data/ext/ice/cpp/include/{IceUtil → Ice}/SHA1.h +16 -16
  100. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -1
  101. data/ext/ice/cpp/include/Ice/Service.h +13 -18
  102. data/ext/ice/cpp/include/Ice/SliceChecksums.h +1 -1
  103. data/ext/ice/cpp/include/Ice/SlicedData.h +46 -20
  104. data/ext/ice/cpp/include/Ice/SlicedDataF.h +14 -6
  105. data/ext/ice/cpp/include/Ice/StreamHelpers.h +159 -49
  106. data/ext/ice/cpp/include/Ice/StringConverter.h +52 -0
  107. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -1
  108. data/{slice/Ice/ObjectFactoryF.ice → ext/ice/cpp/include/Ice/UUID.h} +9 -7
  109. data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +21 -22
  110. data/ext/ice/cpp/include/Ice/UniqueRef.h +98 -0
  111. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +40 -8
  112. data/ext/ice/cpp/include/Ice/Value.h +104 -0
  113. data/{slice/Freeze/ConnectionF.ice → ext/ice/cpp/include/Ice/ValueF.h} +11 -7
  114. data/ext/ice/cpp/include/IceSSL/Config.h +8 -23
  115. data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -6
  116. data/ext/ice/cpp/include/IceSSL/OpenSSL.h +130 -0
  117. data/ext/ice/cpp/include/IceSSL/Plugin.h +172 -259
  118. data/ext/ice/cpp/include/IceSSL/SChannel.h +66 -0
  119. data/ext/ice/cpp/include/IceSSL/SecureTransport.h +66 -0
  120. data/ext/ice/cpp/include/IceSSL/UWP.h +58 -0
  121. data/ext/ice/cpp/include/IceUtil/Atomic.h +8 -10
  122. data/ext/ice/cpp/include/IceUtil/Cond.h +17 -18
  123. data/ext/ice/cpp/include/IceUtil/Config.h +138 -39
  124. data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +97 -0
  125. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -5
  126. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +23 -17
  127. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +1 -3
  128. data/ext/ice/cpp/include/IceUtil/Exception.h +157 -67
  129. data/ext/ice/cpp/include/IceUtil/FileUtil.h +148 -0
  130. data/ext/ice/cpp/include/IceUtil/Functional.h +1 -2
  131. data/ext/ice/cpp/include/IceUtil/Handle.h +11 -11
  132. data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -10
  133. data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -3
  134. data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -2
  135. data/ext/ice/cpp/include/IceUtil/Lock.h +8 -10
  136. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -2
  137. data/ext/ice/cpp/include/IceUtil/Mutex.h +17 -11
  138. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -2
  139. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -4
  140. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -4
  141. data/ext/ice/cpp/include/IceUtil/Optional.h +32 -18
  142. data/ext/ice/cpp/include/IceUtil/Options.h +17 -18
  143. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +55 -29
  144. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -6
  145. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +11 -10
  146. data/ext/ice/cpp/include/IceUtil/Random.h +3 -3
  147. data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -8
  148. data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +58 -0
  149. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +1 -9
  150. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -2
  151. data/ext/ice/cpp/include/IceUtil/Shared.h +5 -7
  152. data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -2
  153. data/ext/ice/cpp/include/IceUtil/StringConverter.h +77 -72
  154. data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -21
  155. data/ext/ice/cpp/include/IceUtil/Thread.h +10 -12
  156. data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -42
  157. data/ext/ice/cpp/include/IceUtil/Time.h +3 -3
  158. data/ext/ice/cpp/include/IceUtil/Timer.h +14 -13
  159. data/ext/ice/cpp/include/IceUtil/UUID.h +2 -2
  160. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -1
  161. data/ext/ice/cpp/include/{Ice → generated/Ice}/BuiltinSequences.h +41 -8
  162. data/ext/ice/cpp/include/generated/Ice/Communicator.h +364 -0
  163. data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +40 -8
  164. data/ext/ice/cpp/include/generated/Ice/Connection.h +872 -0
  165. data/ext/ice/cpp/include/{Ice → generated/Ice}/ConnectionF.h +46 -8
  166. data/ext/ice/cpp/include/{Ice → generated/Ice}/Current.h +71 -8
  167. data/ext/ice/cpp/include/generated/Ice/Endpoint.h +582 -0
  168. data/ext/ice/cpp/include/{Ice → generated/Ice}/EndpointF.h +62 -8
  169. data/ext/ice/cpp/include/{Ice → generated/Ice}/EndpointTypes.h +31 -16
  170. data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +23 -8
  171. data/ext/ice/cpp/include/generated/Ice/Identity.h +221 -0
  172. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContext.h +72 -13
  173. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +40 -8
  174. data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +602 -0
  175. data/ext/ice/cpp/include/{Ice → generated/Ice}/InstrumentationF.h +54 -8
  176. data/ext/ice/cpp/include/generated/Ice/LocalException.h +2802 -0
  177. data/ext/ice/cpp/include/generated/Ice/Locator.h +2036 -0
  178. data/ext/ice/cpp/include/{Ice → generated/Ice}/LocatorF.h +53 -12
  179. data/ext/ice/cpp/include/{Ice → generated/Ice}/Logger.h +71 -13
  180. data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +40 -8
  181. data/ext/ice/cpp/include/generated/Ice/Metrics.h +2649 -0
  182. data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +302 -0
  183. data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +40 -8
  184. data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +142 -0
  185. data/ext/ice/cpp/include/generated/Ice/Plugin.h +197 -0
  186. data/ext/ice/cpp/include/{Ice → generated/Ice}/PluginF.h +43 -8
  187. data/ext/ice/cpp/include/generated/Ice/Process.h +536 -0
  188. data/ext/ice/cpp/include/{Ice → generated/Ice}/ProcessF.h +45 -10
  189. data/ext/ice/cpp/include/{Ice → generated/Ice}/Properties.h +88 -21
  190. data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +749 -0
  191. data/ext/ice/cpp/include/{Ice → generated/Ice}/PropertiesF.h +48 -10
  192. data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +1449 -0
  193. data/ext/ice/cpp/include/generated/Ice/Router.h +1032 -0
  194. data/ext/ice/cpp/include/{Ice → generated/Ice}/RouterF.h +45 -10
  195. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocator.h +65 -13
  196. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +40 -8
  197. data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +23 -8
  198. data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +169 -0
  199. data/ext/ice/cpp/include/generated/Ice/Version.h +334 -0
  200. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +172 -0
  201. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +98 -0
  202. data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +156 -0
  203. data/ext/ice/cpp/src/Ice/ACM.cpp +18 -14
  204. data/ext/ice/cpp/src/Ice/ACM.h +9 -2
  205. data/ext/ice/cpp/{include → src}/Ice/ACMF.h +10 -5
  206. data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -1
  207. data/ext/ice/cpp/src/Ice/Acceptor.h +4 -3
  208. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -1
  209. data/ext/ice/cpp/src/{IceUtil → Ice}/ArgVector.cpp +9 -9
  210. data/ext/ice/cpp/src/{IceUtil → Ice}/ArgVector.h +7 -7
  211. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -538
  212. data/ext/ice/cpp/src/Ice/Base64.cpp +11 -11
  213. data/ext/ice/cpp/src/Ice/Base64.h +1 -1
  214. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +40 -12
  215. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -10
  216. data/ext/ice/cpp/src/Ice/Buffer.cpp +74 -12
  217. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +20 -6
  218. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +85 -190
  219. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -18
  220. data/ext/ice/cpp/src/Ice/Communicator.cpp +39 -8
  221. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +27 -5
  222. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +271 -104
  223. data/ext/ice/cpp/src/Ice/CommunicatorI.h +84 -28
  224. data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -3
  225. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +58 -125
  226. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +11 -22
  227. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -2
  228. data/ext/ice/cpp/src/Ice/Connection.cpp +88 -8
  229. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +27 -5
  230. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +158 -80
  231. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +41 -23
  232. data/ext/ice/cpp/{include → src}/Ice/ConnectionFactoryF.h +8 -3
  233. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +707 -653
  234. data/ext/ice/cpp/src/Ice/ConnectionI.h +97 -69
  235. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -15
  236. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +4 -3
  237. data/ext/ice/cpp/src/Ice/Connector.cpp +6 -1
  238. data/ext/ice/cpp/src/Ice/Connector.h +4 -3
  239. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -1
  240. data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -4
  241. data/ext/ice/cpp/src/Ice/Current.cpp +29 -6
  242. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +6 -5
  243. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -1
  244. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -1
  245. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +5 -25
  246. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +29 -19
  247. data/ext/ice/cpp/src/Ice/Endpoint.cpp +85 -6
  248. data/ext/ice/cpp/src/Ice/EndpointF.cpp +27 -5
  249. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -1
  250. data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -6
  251. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -1
  252. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +35 -19
  253. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -4
  254. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -1
  255. data/ext/ice/cpp/src/Ice/EndpointI.cpp +17 -1
  256. data/ext/ice/cpp/src/Ice/EndpointI.h +35 -9
  257. data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -5
  258. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +18 -6
  259. data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -4
  260. data/ext/ice/cpp/src/Ice/EventHandler.h +13 -8
  261. data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -2
  262. data/ext/ice/cpp/src/Ice/Exception.cpp +95 -86
  263. data/ext/ice/cpp/src/Ice/FacetMap.cpp +20 -6
  264. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -28
  265. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -4
  266. data/ext/ice/cpp/src/Ice/GCObject.cpp +28 -25
  267. data/ext/ice/cpp/src/Ice/HashUtil.h +2 -3
  268. data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -2
  269. data/ext/ice/cpp/src/Ice/HttpParser.h +1 -1
  270. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +92 -53
  271. data/ext/ice/cpp/src/Ice/IPEndpointI.h +19 -10
  272. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -2
  273. data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +56 -0
  274. data/ext/ice/cpp/src/Ice/Identity.cpp +24 -10
  275. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +37 -6
  276. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +27 -5
  277. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +14 -14
  278. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -5
  279. data/ext/ice/cpp/src/Ice/Incoming.cpp +276 -245
  280. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -209
  281. data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -4
  282. data/ext/ice/cpp/src/Ice/Initialize.cpp +299 -172
  283. data/ext/ice/cpp/src/Ice/InputStream.cpp +2773 -0
  284. data/ext/ice/cpp/src/Ice/Instance.cpp +191 -231
  285. data/ext/ice/cpp/src/Ice/Instance.h +30 -18
  286. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +106 -7
  287. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +27 -5
  288. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +117 -99
  289. data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -31
  290. data/ext/ice/cpp/src/Ice/LocalException.cpp +1190 -416
  291. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -2
  292. data/ext/ice/cpp/src/Ice/Locator.cpp +1167 -1215
  293. data/ext/ice/cpp/src/Ice/LocatorF.cpp +29 -6
  294. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +129 -163
  295. data/ext/ice/cpp/src/Ice/LocatorInfo.h +29 -29
  296. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -1
  297. data/ext/ice/cpp/src/Ice/Logger.cpp +35 -5
  298. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +178 -73
  299. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -4
  300. data/ext/ice/cpp/src/Ice/LoggerF.cpp +27 -5
  301. data/ext/ice/cpp/src/Ice/LoggerI.cpp +14 -44
  302. data/ext/ice/cpp/src/Ice/LoggerI.h +7 -13
  303. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -12
  304. data/ext/ice/cpp/src/Ice/Metrics.cpp +1059 -1069
  305. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +49 -19
  306. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -2
  307. data/ext/ice/cpp/src/Ice/Network.cpp +534 -170
  308. data/ext/ice/cpp/src/Ice/Network.h +100 -23
  309. data/ext/ice/cpp/src/Ice/NetworkF.h +2 -2
  310. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +21 -14
  311. data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -2
  312. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -1
  313. data/ext/ice/cpp/src/Ice/Object.cpp +217 -221
  314. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -6
  315. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +27 -5
  316. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +35 -14
  317. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -7
  318. data/ext/ice/cpp/{include → src}/Ice/ObjectAdapterFactoryF.h +5 -1
  319. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +184 -58
  320. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +32 -26
  321. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +37 -6
  322. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -32
  323. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +40 -18
  324. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +14 -5
  325. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +803 -365
  326. data/ext/ice/cpp/src/Ice/OutputStream.cpp +1399 -0
  327. data/ext/ice/cpp/src/Ice/Plugin.cpp +45 -6
  328. data/ext/ice/cpp/src/Ice/PluginF.cpp +27 -5
  329. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +13 -13
  330. data/ext/ice/cpp/src/Ice/PluginManagerI.h +5 -6
  331. data/ext/ice/cpp/src/Ice/Process.cpp +256 -114
  332. data/ext/ice/cpp/src/Ice/ProcessF.cpp +29 -6
  333. data/ext/ice/cpp/src/Ice/Properties.cpp +38 -8
  334. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +340 -328
  335. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +81 -17
  336. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -5
  337. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +29 -6
  338. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +25 -26
  339. data/ext/ice/cpp/src/Ice/PropertiesI.h +8 -11
  340. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +107 -50
  341. data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -2
  342. data/ext/ice/cpp/src/Ice/Protocol.cpp +2 -2
  343. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -2
  344. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -20
  345. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -1
  346. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -1
  347. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -1
  348. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -1
  349. data/ext/ice/cpp/src/Ice/Proxy.cpp +690 -964
  350. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +23 -32
  351. data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -11
  352. data/ext/ice/cpp/src/Ice/Reference.cpp +75 -69
  353. data/ext/ice/cpp/src/Ice/Reference.h +27 -22
  354. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +18 -21
  355. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -12
  356. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -1
  357. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +18 -4
  358. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -1
  359. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +672 -552
  360. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -1
  361. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -3
  362. data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -13
  363. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -6
  364. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -2
  365. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -6
  366. data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -7
  367. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +6 -12
  368. data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -6
  369. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -1
  370. data/ext/ice/cpp/src/Ice/Router.cpp +523 -474
  371. data/ext/ice/cpp/src/Ice/RouterF.cpp +29 -6
  372. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +91 -70
  373. data/ext/ice/cpp/src/Ice/RouterInfo.h +43 -32
  374. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -1
  375. data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +21 -21
  376. data/ext/ice/cpp/src/Ice/Selector.cpp +989 -923
  377. data/ext/ice/cpp/src/Ice/Selector.h +100 -147
  378. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +37 -6
  379. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +27 -5
  380. data/ext/ice/cpp/src/Ice/ServantManager.cpp +9 -9
  381. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -1
  382. data/ext/ice/cpp/src/Ice/SharedContext.h +2 -2
  383. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +20 -6
  384. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -2
  385. data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -20
  386. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +173 -18
  387. data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -4
  388. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +48 -17
  389. data/ext/ice/cpp/src/Ice/StringUtil.h +35 -0
  390. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +8 -4
  391. data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -3
  392. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +158 -32
  393. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -5
  394. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +1 -7
  395. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -2
  396. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +40 -32
  397. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +11 -8
  398. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +12 -27
  399. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -10
  400. data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +24 -41
  401. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +175 -267
  402. data/ext/ice/cpp/src/Ice/ThreadPool.h +38 -43
  403. data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +28 -21
  404. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -2
  405. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -1
  406. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -2
  407. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -31
  408. data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -6
  409. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -2
  410. data/ext/ice/cpp/src/Ice/Transceiver.h +8 -7
  411. data/ext/ice/cpp/src/Ice/TransceiverF.h +1 -1
  412. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +2 -8
  413. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -2
  414. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +92 -31
  415. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +12 -4
  416. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +150 -179
  417. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -17
  418. data/ext/ice/cpp/src/Ice/Value.cpp +81 -0
  419. data/ext/ice/cpp/src/Ice/ValueFactory.cpp +84 -0
  420. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +70 -0
  421. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +42 -0
  422. data/ext/ice/cpp/src/Ice/Version.cpp +24 -14
  423. data/ext/ice/cpp/src/Ice/VirtualShared.h +43 -0
  424. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -9
  425. data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -7
  426. data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -11
  427. data/ext/ice/cpp/src/Ice/WSConnector.h +3 -6
  428. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +185 -80
  429. data/ext/ice/cpp/src/Ice/WSEndpoint.h +21 -31
  430. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +41 -37
  431. data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -21
  432. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +526 -264
  433. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +341 -455
  434. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +86 -26
  435. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -23
  436. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -61
  437. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -36
  438. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -59
  439. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -3
  440. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +396 -159
  441. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +251 -355
  442. data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +52 -0
  443. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +526 -131
  444. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +19 -165
  445. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -17
  446. data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +284 -0
  447. data/ext/ice/cpp/src/IceSSL/CertificateI.h +69 -0
  448. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +39 -11
  449. data/ext/ice/cpp/src/{Ice/ObjectFactoryF.cpp → IceSSL/ConnectionInfoF.cpp} +31 -9
  450. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +14 -56
  451. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -13
  452. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +205 -197
  453. data/ext/ice/cpp/src/IceSSL/EndpointI.h +41 -33
  454. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +39 -10
  455. data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -6
  456. data/ext/ice/cpp/src/IceSSL/Instance.h +7 -7
  457. data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -7
  458. data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +588 -0
  459. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +117 -152
  460. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +64 -0
  461. data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +32 -0
  462. data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +132 -0
  463. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +400 -89
  464. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +36 -21
  465. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +291 -0
  466. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +63 -0
  467. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -41
  468. data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -18
  469. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -54
  470. data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -7
  471. data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +585 -0
  472. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +491 -75
  473. data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +126 -0
  474. data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +32 -0
  475. data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +78 -0
  476. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +126 -169
  477. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +19 -22
  478. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +79 -74
  479. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +24 -187
  480. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -19
  481. data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +862 -0
  482. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +56 -214
  483. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +60 -0
  484. data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +31 -0
  485. data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +80 -0
  486. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +137 -144
  487. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +25 -28
  488. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +857 -0
  489. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +46 -0
  490. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +9 -13
  491. data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -4
  492. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -3
  493. data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +271 -0
  494. data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +343 -0
  495. data/ext/ice/cpp/src/IceSSL/UWPEngine.h +46 -0
  496. data/ext/ice/cpp/{include/Ice/ObjectFactoryManagerF.h → src/IceSSL/UWPEngineF.h} +13 -8
  497. data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +94 -0
  498. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +388 -0
  499. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +76 -0
  500. data/ext/ice/cpp/src/IceSSL/Util.cpp +66 -1256
  501. data/ext/ice/cpp/src/IceSSL/Util.h +48 -137
  502. data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +162 -0
  503. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -22
  504. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -26
  505. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +20 -31
  506. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +25 -116
  507. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -1
  508. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -1
  509. data/ext/ice/cpp/src/IceUtil/Options.cpp +23 -46
  510. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +7 -6
  511. data/ext/ice/cpp/src/IceUtil/Random.cpp +13 -13
  512. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +3 -9
  513. data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -3
  514. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -264
  515. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +540 -235
  516. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -74
  517. data/ext/ice/cpp/src/IceUtil/Time.cpp +1 -1
  518. data/ext/ice/cpp/src/IceUtil/UUID.cpp +10 -10
  519. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +98 -97
  520. data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -35
  521. data/ext/ice/cpp/src/IceUtil/UtilException.cpp +838 -0
  522. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +815 -163
  523. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +76 -0
  524. data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -2
  525. data/ext/ice/cpp/{include → src}/Slice/Checksum.h +2 -2
  526. data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -78
  527. data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -9
  528. data/ext/ice/cpp/src/Slice/Grammar.cpp +1994 -1943
  529. data/ext/ice/cpp/src/Slice/Grammar.h +44 -24
  530. data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -14
  531. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2658 -1927
  532. data/ext/ice/cpp/{include → src}/Slice/JavaUtil.h +178 -59
  533. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -1
  534. data/ext/ice/cpp/src/Slice/MD5.h +1 -1
  535. data/ext/ice/cpp/src/Slice/MD5I.cpp +0 -1
  536. data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
  537. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +12 -15
  538. data/ext/ice/cpp/{include → src}/Slice/PHPUtil.h +6 -15
  539. data/ext/ice/cpp/src/Slice/Parser.cpp +802 -307
  540. data/ext/ice/cpp/{include → src}/Slice/Parser.h +76 -84
  541. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +43 -21
  542. data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +7 -12
  543. data/ext/ice/cpp/src/Slice/Python.cpp +207 -86
  544. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +683 -679
  545. data/ext/ice/cpp/{include → src}/Slice/PythonUtil.h +19 -8
  546. data/ext/ice/cpp/src/Slice/Ruby.cpp +38 -34
  547. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +177 -445
  548. data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -6
  549. data/ext/ice/cpp/src/Slice/Scanner.cpp +218 -306
  550. data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +37 -64
  551. data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +374 -0
  552. data/ext/ice/cpp/src/Slice/Util.h +54 -0
  553. data/ext/ice/mcpp/Makefile +5 -2
  554. data/ice.gemspec +2 -7
  555. data/lib/Glacier2.rb +1 -1
  556. data/lib/Glacier2/Metrics.rb +7 -46
  557. data/lib/Glacier2/PermissionsVerifier.rb +24 -95
  558. data/lib/Glacier2/PermissionsVerifierF.rb +3 -3
  559. data/lib/Glacier2/Router.rb +32 -74
  560. data/lib/Glacier2/RouterF.rb +3 -3
  561. data/lib/Glacier2/SSLInfo.rb +4 -7
  562. data/lib/Glacier2/Session.rb +88 -307
  563. data/lib/Ice.rb +83 -52
  564. data/lib/Ice/BuiltinSequences.rb +4 -4
  565. data/lib/Ice/Communicator.rb +56 -58
  566. data/lib/Ice/CommunicatorF.rb +3 -3
  567. data/lib/Ice/Connection.rb +153 -162
  568. data/lib/Ice/ConnectionF.rb +3 -3
  569. data/lib/Ice/Current.rb +4 -11
  570. data/lib/Ice/Endpoint.rb +57 -133
  571. data/lib/Ice/EndpointF.rb +3 -3
  572. data/lib/Ice/EndpointTypes.rb +3 -7
  573. data/lib/Ice/FacetMap.rb +4 -4
  574. data/lib/Ice/Identity.rb +5 -8
  575. data/lib/Ice/ImplicitContext.rb +5 -34
  576. data/lib/Ice/ImplicitContextF.rb +3 -3
  577. data/lib/Ice/Instrumentation.rb +23 -275
  578. data/lib/Ice/InstrumentationF.rb +3 -3
  579. data/lib/Ice/LocalException.rb +95 -141
  580. data/lib/Ice/Locator.rb +51 -165
  581. data/lib/Ice/LocatorF.rb +3 -3
  582. data/lib/Ice/Logger.rb +5 -34
  583. data/lib/Ice/LoggerF.rb +3 -3
  584. data/lib/Ice/Metrics.rb +61 -416
  585. data/lib/Ice/ObjectAdapter.rb +34 -0
  586. data/lib/Ice/ObjectAdapterF.rb +3 -3
  587. data/lib/Ice/ObjectFactory.rb +5 -30
  588. data/lib/Ice/Plugin.rb +7 -60
  589. data/lib/Ice/PluginF.rb +3 -3
  590. data/lib/Ice/Process.rb +16 -52
  591. data/lib/Ice/ProcessF.rb +3 -3
  592. data/lib/Ice/Properties.rb +5 -41
  593. data/lib/Ice/PropertiesAdmin.rb +19 -56
  594. data/lib/Ice/PropertiesF.rb +3 -3
  595. data/lib/Ice/RemoteLogger.rb +34 -115
  596. data/lib/Ice/Router.rb +29 -101
  597. data/lib/Ice/RouterF.rb +3 -3
  598. data/lib/Ice/ServantLocator.rb +31 -0
  599. data/lib/Ice/{ObjectFactoryF.rb → ServantLocatorF.rb} +6 -6
  600. data/lib/Ice/SliceChecksumDict.rb +3 -3
  601. data/lib/Ice/ValueFactory.rb +33 -0
  602. data/lib/Ice/Version.rb +5 -11
  603. data/lib/IceBox.rb +1 -1
  604. data/lib/IceBox/IceBox.rb +44 -148
  605. data/lib/IceGrid.rb +1 -4
  606. data/lib/IceGrid/Admin.rb +551 -427
  607. data/lib/IceGrid/Descriptor.rb +62 -529
  608. data/lib/IceGrid/Exception.rb +24 -45
  609. data/lib/IceGrid/FileParser.rb +14 -50
  610. data/lib/IceGrid/PluginFacade.rb +40 -0
  611. data/lib/IceGrid/Registry.rb +151 -58
  612. data/lib/IceGrid/Session.rb +25 -64
  613. data/lib/IceGrid/UserAccountMapper.rb +14 -50
  614. data/lib/IcePatch2.rb +1 -1
  615. data/lib/IcePatch2/FileInfo.rb +5 -11
  616. data/lib/IcePatch2/FileServer.rb +33 -76
  617. data/lib/IceStorm.rb +1 -1
  618. data/lib/IceStorm/IceStorm.rb +79 -206
  619. data/lib/IceStorm/Metrics.rb +11 -89
  620. data/slice/Glacier2/Metrics.ice +8 -4
  621. data/slice/Glacier2/PermissionsVerifier.ice +10 -7
  622. data/slice/Glacier2/PermissionsVerifierF.ice +7 -4
  623. data/slice/Glacier2/Router.ice +10 -8
  624. data/slice/Glacier2/RouterF.ice +7 -4
  625. data/slice/Glacier2/SSLInfo.ice +8 -5
  626. data/slice/Glacier2/Session.ice +15 -13
  627. data/slice/Ice/BuiltinSequences.ice +7 -4
  628. data/slice/Ice/Communicator.ice +141 -66
  629. data/slice/Ice/CommunicatorF.ice +7 -4
  630. data/slice/Ice/Connection.ice +183 -86
  631. data/slice/Ice/ConnectionF.ice +7 -4
  632. data/slice/Ice/Current.ice +13 -9
  633. data/slice/Ice/Endpoint.ice +63 -14
  634. data/slice/Ice/EndpointF.ice +7 -4
  635. data/slice/Ice/EndpointTypes.ice +8 -6
  636. data/slice/Ice/FacetMap.ice +7 -4
  637. data/slice/Ice/Identity.ice +13 -5
  638. data/slice/Ice/ImplicitContext.ice +20 -18
  639. data/slice/Ice/ImplicitContextF.ice +7 -4
  640. data/slice/Ice/Instrumentation.ice +20 -19
  641. data/slice/Ice/InstrumentationF.ice +8 -5
  642. data/slice/Ice/LocalException.ice +87 -87
  643. data/slice/Ice/Locator.ice +19 -18
  644. data/slice/Ice/LocatorF.ice +7 -4
  645. data/slice/Ice/Logger.ice +9 -7
  646. data/slice/Ice/LoggerF.ice +7 -4
  647. data/slice/Ice/Metrics.ice +18 -14
  648. data/slice/Ice/ObjectAdapter.ice +30 -13
  649. data/slice/Ice/ObjectAdapterF.ice +7 -4
  650. data/slice/Ice/ObjectFactory.ice +15 -12
  651. data/slice/Ice/Plugin.ice +9 -6
  652. data/slice/Ice/PluginF.ice +8 -5
  653. data/slice/Ice/Process.ice +9 -6
  654. data/slice/Ice/ProcessF.ice +7 -4
  655. data/slice/Ice/Properties.ice +15 -12
  656. data/slice/Ice/PropertiesAdmin.ice +9 -5
  657. data/slice/Ice/PropertiesF.ice +7 -4
  658. data/slice/Ice/RemoteLogger.ice +33 -24
  659. data/slice/Ice/Router.ice +16 -7
  660. data/slice/Ice/RouterF.ice +7 -4
  661. data/slice/Ice/ServantLocator.ice +13 -10
  662. data/slice/Ice/ServantLocatorF.ice +7 -4
  663. data/slice/Ice/SliceChecksumDict.ice +7 -4
  664. data/slice/Ice/ValueFactory.ice +127 -0
  665. data/slice/Ice/Version.ice +9 -5
  666. data/slice/IceBT/ConnectionInfo.ice +53 -0
  667. data/slice/IceBT/EndpointInfo.ice +51 -0
  668. data/slice/IceBT/Types.ice +39 -0
  669. data/slice/IceBox/IceBox.ice +20 -21
  670. data/slice/IceDiscovery/IceDiscovery.ice +9 -5
  671. data/slice/IceGrid/Admin.ice +390 -30
  672. data/slice/IceGrid/Descriptor.ice +37 -29
  673. data/slice/IceGrid/Exception.ice +33 -27
  674. data/slice/IceGrid/FileParser.ice +9 -6
  675. data/slice/IceGrid/PluginFacade.ice +11 -9
  676. data/slice/IceGrid/Registry.ice +139 -16
  677. data/slice/IceGrid/Session.ice +10 -8
  678. data/slice/IceGrid/UserAccountMapper.ice +9 -6
  679. data/slice/IceIAP/ConnectionInfo.ice +70 -0
  680. data/slice/IceIAP/EndpointInfo.ice +64 -0
  681. data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +9 -7
  682. data/slice/IcePatch2/FileInfo.ice +9 -8
  683. data/slice/IcePatch2/FileServer.ice +17 -13
  684. data/slice/IceSSL/ConnectionInfo.ice +14 -17
  685. data/slice/IceSSL/ConnectionInfoF.ice +24 -0
  686. data/slice/IceSSL/EndpointInfo.ice +9 -30
  687. data/slice/IceStorm/IceStorm.ice +22 -18
  688. data/slice/IceStorm/Metrics.ice +9 -5
  689. metadata +154 -120
  690. data/ext/ObjectFactory.cpp +0 -140
  691. data/ext/ObjectFactory.h +0 -50
  692. data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
  693. data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
  694. data/ext/ice/cpp/include/Ice/Connection.h +0 -497
  695. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
  696. data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
  697. data/ext/ice/cpp/include/Ice/Identity.h +0 -168
  698. data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
  699. data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
  700. data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
  701. data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
  702. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
  703. data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
  704. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
  705. data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
  706. data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
  707. data/ext/ice/cpp/include/Ice/Process.h +0 -574
  708. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
  709. data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
  710. data/ext/ice/cpp/include/Ice/Router.h +0 -1159
  711. data/ext/ice/cpp/include/Ice/Stream.h +0 -447
  712. data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
  713. data/ext/ice/cpp/include/Ice/Version.h +0 -262
  714. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
  715. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
  716. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
  717. data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
  718. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
  719. data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
  720. data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
  721. data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
  722. data/ext/ice/cpp/include/Slice/Util.h +0 -56
  723. data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
  724. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
  725. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
  726. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
  727. data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
  728. data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
  729. data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
  730. data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
  731. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
  732. data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
  733. data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
  734. data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
  735. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
  736. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
  737. data/lib/IceGrid/Locator.rb +0 -106
  738. data/lib/IceGrid/Observer.rb +0 -572
  739. data/lib/IceGrid/Query.rb +0 -169
  740. data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
  741. data/slice/Freeze/CatalogData.ice +0 -49
  742. data/slice/Freeze/Connection.ice +0 -121
  743. data/slice/Freeze/DB.ice +0 -37
  744. data/slice/Freeze/Evictor.ice +0 -346
  745. data/slice/Freeze/EvictorF.ice +0 -22
  746. data/slice/Freeze/EvictorStorage.ice +0 -72
  747. data/slice/Freeze/Exception.ice +0 -100
  748. data/slice/Freeze/Transaction.ice +0 -58
  749. data/slice/Freeze/TransactionalEvictor.ice +0 -50
  750. data/slice/IceGrid/Locator.ice +0 -57
  751. data/slice/IceGrid/Observer.ice +0 -395
  752. data/slice/IceGrid/Query.ice +0 -131
@@ -1,6 +1,6 @@
1
1
  // **********************************************************************
2
2
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
3
+ // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4
4
  //
5
5
  // This copy of Ice is licensed to you under the terms described in the
6
6
  // ICE_LICENSE file included in this distribution.
@@ -27,6 +27,7 @@
27
27
  #include <Ice/EndpointI.h>
28
28
  #include <Ice/InstrumentationF.h>
29
29
  #include <Ice/ACMF.h>
30
+ #include <Ice/Comparable.h>
30
31
 
31
32
  #include <list>
32
33
  #include <set>
@@ -36,18 +37,18 @@ namespace Ice
36
37
 
37
38
  class LocalException;
38
39
  class ObjectAdapterI;
39
- typedef IceUtil::Handle<ObjectAdapterI> ObjectAdapterIPtr;
40
+ ICE_DEFINE_PTR(ObjectAdapterIPtr, ObjectAdapterI);
40
41
 
41
42
  }
42
43
 
43
44
  namespace IceInternal
44
45
  {
45
46
 
46
- class OutgoingConnectionFactory : virtual public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
47
+ class OutgoingConnectionFactory : public virtual IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
47
48
  {
48
49
  public:
49
50
 
50
- class CreateConnectionCallback : virtual public IceUtil::Shared
51
+ class CreateConnectionCallback : public virtual IceUtil::Shared
51
52
  {
52
53
  public:
53
54
 
@@ -62,18 +63,17 @@ public:
62
63
 
63
64
  void waitUntilFinished();
64
65
 
65
- void create(const std::vector<EndpointIPtr>&, bool, Ice::EndpointSelectionType,
66
- const CreateConnectionCallbackPtr&);
66
+ void create(const std::vector<EndpointIPtr>&, bool, Ice::EndpointSelectionType, const CreateConnectionCallbackPtr&);
67
67
  void setRouterInfo(const RouterInfoPtr&);
68
68
  void removeAdapter(const Ice::ObjectAdapterPtr&);
69
- void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&);
70
-
71
- private:
69
+ void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&, Ice::CompressBatch);
72
70
 
73
71
  OutgoingConnectionFactory(const Ice::CommunicatorPtr&, const InstancePtr&);
74
72
  virtual ~OutgoingConnectionFactory();
75
73
  friend class Instance;
76
74
 
75
+ private:
76
+
77
77
  struct ConnectorInfo
78
78
  {
79
79
  ConnectorInfo(const ConnectorPtr& c, const EndpointIPtr& e) : connector(c), endpoint(e)
@@ -86,7 +86,12 @@ private:
86
86
  EndpointIPtr endpoint;
87
87
  };
88
88
 
89
- class ConnectCallback : public Ice::ConnectionI::StartCallback, public IceInternal::EndpointI_connectors
89
+ class ConnectCallback : public Ice::ConnectionI::StartCallback,
90
+ public IceInternal::EndpointI_connectors
91
+ #ifdef ICE_CPP11_MAPPING
92
+ , public std::enable_shared_from_this<ConnectCallback>
93
+ #endif
94
+
90
95
  {
91
96
  public:
92
97
 
@@ -129,7 +134,7 @@ private:
129
134
  std::vector<ConnectorInfo> _connectors;
130
135
  std::vector<ConnectorInfo>::const_iterator _iter;
131
136
  };
132
- typedef IceUtil::Handle<ConnectCallback> ConnectCallbackPtr;
137
+ ICE_DEFINE_PTR(ConnectCallbackPtr, ConnectCallback);
133
138
  friend class ConnectCallback;
134
139
 
135
140
  std::vector<EndpointIPtr> applyOverrides(const std::vector<EndpointIPtr>&);
@@ -158,7 +163,11 @@ private:
158
163
  std::multimap<ConnectorPtr, Ice::ConnectionIPtr> _connections;
159
164
  std::map<ConnectorPtr, std::set<ConnectCallbackPtr> > _pending;
160
165
 
166
+ #ifdef ICE_CPP11_MAPPING
167
+ std::multimap<EndpointIPtr, Ice::ConnectionIPtr, Ice::TargetCompare<EndpointIPtr, std::less>> _connectionsByEndpoint;
168
+ #else
161
169
  std::multimap<EndpointIPtr, Ice::ConnectionIPtr> _connectionsByEndpoint;
170
+ #endif
162
171
  int _pendingConnectCount;
163
172
  };
164
173
 
@@ -172,25 +181,24 @@ public:
172
181
  void hold();
173
182
  void destroy();
174
183
 
175
- #if TARGET_OS_IPHONE != 0
176
184
  void startAcceptor();
177
185
  void stopAcceptor();
178
- #endif
179
186
 
180
187
  void updateConnectionObservers();
181
188
 
182
189
  void waitUntilHolding() const;
183
190
  void waitUntilFinished();
184
191
 
192
+ bool isLocal(const EndpointIPtr&) const;
185
193
  EndpointIPtr endpoint() const;
186
194
  std::list<Ice::ConnectionIPtr> connections() const;
187
- void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&);
195
+ void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&, Ice::CompressBatch);
188
196
 
189
197
  //
190
198
  // Operations from EventHandler
191
199
  //
192
200
 
193
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
201
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
194
202
  virtual bool startAsync(SocketOperation);
195
203
  virtual bool finishAsync(SocketOperation);
196
204
  #endif
@@ -203,11 +211,20 @@ public:
203
211
  virtual void connectionStartCompleted(const Ice::ConnectionIPtr&);
204
212
  virtual void connectionStartFailed(const Ice::ConnectionIPtr&, const Ice::LocalException&);
205
213
 
206
- private:
207
-
208
- IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const Ice::ObjectAdapterIPtr&);
214
+ IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const EndpointIPtr&,
215
+ const Ice::ObjectAdapterIPtr&);
209
216
  void initialize();
210
217
  virtual ~IncomingConnectionFactory();
218
+
219
+ #ifdef ICE_CPP11_MAPPING
220
+ std::shared_ptr<IncomingConnectionFactory> shared_from_this()
221
+ {
222
+ return std::static_pointer_cast<IncomingConnectionFactory>(EventHandler::shared_from_this());
223
+ }
224
+ #endif
225
+
226
+ private:
227
+
211
228
  friend class Ice::ObjectAdapterI;
212
229
 
213
230
  enum State
@@ -229,18 +246,19 @@ private:
229
246
  AcceptorPtr _acceptor;
230
247
  const TransceiverPtr _transceiver;
231
248
  EndpointIPtr _endpoint;
249
+ EndpointIPtr _publishedEndpoint;
232
250
 
233
- #if TARGET_OS_IPHONE != 0
234
251
  bool _acceptorStarted;
235
- #endif
252
+ bool _acceptorStopped;
236
253
 
237
254
  Ice::ObjectAdapterIPtr _adapter;
238
-
239
255
  const bool _warn;
240
-
241
256
  std::set<Ice::ConnectionIPtr> _connections;
242
-
243
257
  State _state;
258
+
259
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
260
+ IceInternal::UniquePtr<Ice::LocalException> _acceptorException;
261
+ #endif
244
262
  };
245
263
 
246
264
  }
@@ -1,6 +1,6 @@
1
1
  // **********************************************************************
2
2
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
3
+ // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4
4
  //
5
5
  // This copy of Ice is licensed to you under the terms described in the
6
6
  // ICE_LICENSE file included in this distribution.
@@ -18,12 +18,17 @@ namespace IceInternal
18
18
  {
19
19
 
20
20
  class OutgoingConnectionFactory;
21
- ICE_API IceUtil::Shared* upCast(OutgoingConnectionFactory*);
21
+ IceUtil::Shared* upCast(OutgoingConnectionFactory*);
22
22
  typedef IceInternal::Handle<OutgoingConnectionFactory> OutgoingConnectionFactoryPtr;
23
23
 
24
24
  class IncomingConnectionFactory;
25
- ICE_API IceUtil::Shared* upCast(IncomingConnectionFactory*);
25
+
26
+ #ifdef ICE_CPP11_MAPPING
27
+ using IncomingConnectionFactoryPtr = ::std::shared_ptr<IncomingConnectionFactory>;
28
+ #else
29
+ IceUtil::Shared* upCast(IncomingConnectionFactory*);
26
30
  typedef IceInternal::Handle<IncomingConnectionFactory> IncomingConnectionFactoryPtr;
31
+ #endif
27
32
 
28
33
  }
29
34
 
@@ -1,6 +1,6 @@
1
1
  // **********************************************************************
2
2
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
3
+ // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4
4
  //
5
5
  // This copy of Ice is licensed to you under the terms described in the
6
6
  // ICE_LICENSE file included in this distribution.
@@ -20,7 +20,6 @@
20
20
  #include <Ice/ACM.h>
21
21
  #include <Ice/ObjectAdapterI.h> // For getThreadPool() and getServantManager().
22
22
  #include <Ice/EndpointI.h>
23
- #include <Ice/Outgoing.h>
24
23
  #include <Ice/OutgoingAsync.h>
25
24
  #include <Ice/Incoming.h>
26
25
  #include <Ice/LocalException.h>
@@ -38,13 +37,14 @@ using namespace Ice;
38
37
  using namespace Ice::Instrumentation;
39
38
  using namespace IceInternal;
40
39
 
40
+ #ifndef ICE_CPP11_MAPPING
41
41
  Ice::LocalObject* Ice::upCast(ConnectionI* p) { return p; }
42
+ #endif
42
43
 
43
44
  namespace
44
45
  {
45
46
 
46
- const ::std::string __flushBatchRequests_name = "flushBatchRequests";
47
-
47
+ const ::std::string flushBatchRequests_name = "flushBatchRequests";
48
48
 
49
49
  class TimeoutCallback : public IceUtil::TimerTask
50
50
  {
@@ -72,8 +72,8 @@ public:
72
72
  DispatchCall(const ConnectionIPtr& connection, const ConnectionI::StartCallbackPtr& startCB,
73
73
  const vector<ConnectionI::OutgoingMessage>& sentCBs, Byte compress, Int requestId,
74
74
  Int invokeNum, const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter,
75
- const OutgoingAsyncBasePtr& outAsync, const ConnectionCallbackPtr& heartbeatCallback,
76
- BasicStream& stream) :
75
+ const OutgoingAsyncBasePtr& outAsync, const ICE_DELEGATE(HeartbeatCallback)& heartbeatCallback,
76
+ InputStream& stream) :
77
77
  DispatchWorkItem(connection),
78
78
  _connection(connection),
79
79
  _startCB(startCB),
@@ -108,8 +108,8 @@ private:
108
108
  const ServantManagerPtr _servantManager;
109
109
  const ObjectAdapterPtr _adapter;
110
110
  const OutgoingAsyncBasePtr _outAsync;
111
- const ConnectionCallbackPtr _heartbeatCallback;
112
- BasicStream _stream;
111
+ const ICE_DELEGATE(HeartbeatCallback) _heartbeatCallback;
112
+ InputStream _stream;
113
113
  };
114
114
 
115
115
  class FinishCall : public DispatchWorkItem
@@ -133,19 +133,104 @@ private:
133
133
  const bool _close;
134
134
  };
135
135
 
136
+ //
137
+ // Class for handling Ice::Connection::begin_flushBatchRequests
138
+ //
139
+ class ConnectionFlushBatchAsync : public OutgoingAsyncBase
140
+ {
141
+ public:
142
+
143
+ ConnectionFlushBatchAsync(const Ice::ConnectionIPtr&, const InstancePtr&);
144
+
145
+ virtual Ice::ConnectionPtr getConnection() const;
146
+
147
+ void invoke(const std::string&, Ice::CompressBatch);
148
+
149
+ private:
150
+
151
+ const Ice::ConnectionIPtr _connection;
152
+ };
153
+ typedef IceUtil::Handle<ConnectionFlushBatchAsync> ConnectionFlushBatchAsyncPtr;
154
+
136
155
  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
156
+ ICE_ENUM(ConnectionState, ConnectionStateValidating), // StateNotInitialized
157
+ ICE_ENUM(ConnectionState, ConnectionStateValidating), // StateNotValidated
158
+ ICE_ENUM(ConnectionState, ConnectionStateActive), // StateActive
159
+ ICE_ENUM(ConnectionState, ConnectionStateHolding), // StateHolding
160
+ ICE_ENUM(ConnectionState, ConnectionStateClosing), // StateClosing
161
+ ICE_ENUM(ConnectionState, ConnectionStateClosing), // StateClosingPending
162
+ ICE_ENUM(ConnectionState, ConnectionStateClosed), // StateClosed
163
+ ICE_ENUM(ConnectionState, ConnectionStateClosed), // StateFinished
145
164
  };
146
165
 
147
166
  }
148
167
 
168
+ ConnectionFlushBatchAsync::ConnectionFlushBatchAsync(const ConnectionIPtr& connection, const InstancePtr& instance) :
169
+ OutgoingAsyncBase(instance), _connection(connection)
170
+ {
171
+ }
172
+
173
+ ConnectionPtr
174
+ ConnectionFlushBatchAsync::getConnection() const
175
+ {
176
+ return _connection;
177
+ }
178
+
179
+ void
180
+ ConnectionFlushBatchAsync::invoke(const string& operation, Ice::CompressBatch compressBatch)
181
+ {
182
+ _observer.attach(_instance.get(), operation);
183
+ try
184
+ {
185
+ AsyncStatus status;
186
+ bool compress;
187
+ int batchRequestNum = _connection->getBatchRequestQueue()->swap(&_os, compress);
188
+ if(batchRequestNum == 0)
189
+ {
190
+ status = AsyncStatusSent;
191
+ if(sent())
192
+ {
193
+ status = static_cast<AsyncStatus>(status | AsyncStatusInvokeSentCallback);
194
+ }
195
+ }
196
+ else
197
+ {
198
+ if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, Yes))
199
+ {
200
+ compress = true;
201
+ }
202
+ else if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, No))
203
+ {
204
+ compress = false;
205
+ }
206
+ status = _connection->sendAsyncRequest(ICE_SHARED_FROM_THIS, compress, false, batchRequestNum);
207
+ }
208
+
209
+ if(status & AsyncStatusSent)
210
+ {
211
+ _sentSynchronously = true;
212
+ if(status & AsyncStatusInvokeSentCallback)
213
+ {
214
+ invokeSent();
215
+ }
216
+ }
217
+ }
218
+ catch(const RetryException& ex)
219
+ {
220
+ if(exception(*ex.get()))
221
+ {
222
+ invokeExceptionAsync();
223
+ }
224
+ }
225
+ catch(const Exception& ex)
226
+ {
227
+ if(exception(ex))
228
+ {
229
+ invokeExceptionAsync();
230
+ }
231
+ }
232
+ }
233
+
149
234
  Ice::ConnectionI::Observer::Observer() : _readStreamPos(0), _writeStreamPos(0)
150
235
  {
151
236
  }
@@ -209,9 +294,8 @@ Ice::ConnectionI::Observer::attach(const Ice::Instrumentation::ConnectionObserve
209
294
  }
210
295
  }
211
296
 
212
-
213
297
  void
214
- Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
298
+ Ice::ConnectionI::OutgoingMessage::adopt(OutputStream* str)
215
299
  {
216
300
  if(adopted)
217
301
  {
@@ -228,7 +312,7 @@ Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
228
312
  }
229
313
  else if(!str)
230
314
  {
231
- if(out || outAsync)
315
+ if(outAsync)
232
316
  {
233
317
  return; // Adopting request stream is not necessary.
234
318
  }
@@ -240,7 +324,7 @@ Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
240
324
  }
241
325
 
242
326
  assert(str);
243
- stream = new BasicStream(str->instance(), currentProtocolEncoding);
327
+ stream = new OutputStream(str->instance(), currentProtocolEncoding);
244
328
  stream->swap(*str);
245
329
  adopted = true;
246
330
  }
@@ -248,8 +332,7 @@ Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str)
248
332
  void
249
333
  Ice::ConnectionI::OutgoingMessage::canceled(bool adoptStream)
250
334
  {
251
- assert((out || outAsync)); // Only requests can timeout.
252
- out = 0;
335
+ assert(outAsync); // Only requests can timeout.
253
336
  outAsync = 0;
254
337
  if(adoptStream)
255
338
  {
@@ -270,13 +353,9 @@ Ice::ConnectionI::OutgoingMessage::sent()
270
353
  }
271
354
  stream = 0;
272
355
 
273
- if(out)
274
- {
275
- out->sent();
276
- }
277
- else if(outAsync)
356
+ if(outAsync)
278
357
  {
279
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
358
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
280
359
  invokeSent = outAsync->sent();
281
360
  return invokeSent || receivedReply;
282
361
  #else
@@ -289,15 +368,11 @@ Ice::ConnectionI::OutgoingMessage::sent()
289
368
  void
290
369
  Ice::ConnectionI::OutgoingMessage::completed(const Ice::LocalException& ex)
291
370
  {
292
- if(out)
293
- {
294
- out->completed(ex);
295
- }
296
- else if(outAsync)
371
+ if(outAsync)
297
372
  {
298
- if(outAsync->completed(ex))
373
+ if(outAsync->exception(ex))
299
374
  {
300
- outAsync->invokeCompleted();
375
+ outAsync->invokeException();
301
376
  }
302
377
  }
303
378
 
@@ -316,7 +391,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
316
391
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
317
392
  if(_state >= StateClosed) // The connection might already be closed if the communicator was destroyed.
318
393
  {
319
- assert(_exception.get());
394
+ assert(_exception);
320
395
  _exception->ice_throw();
321
396
  }
322
397
 
@@ -338,7 +413,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
338
413
 
339
414
  if(_state >= StateClosing)
340
415
  {
341
- assert(_exception.get());
416
+ assert(_exception);
342
417
  _exception->ice_throw();
343
418
  }
344
419
  }
@@ -353,7 +428,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
353
428
  exception(ex);
354
429
  if(callback)
355
430
  {
356
- callback->connectionStartFailed(this, *_exception.get());
431
+ callback->connectionStartFailed(ICE_SHARED_FROM_THIS, ex);
357
432
  return;
358
433
  }
359
434
  else
@@ -365,7 +440,7 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
365
440
 
366
441
  if(callback)
367
442
  {
368
- callback->connectionStartCompleted(this);
443
+ callback->connectionStartCompleted(ICE_SHARED_FROM_THIS);
369
444
  }
370
445
  }
371
446
 
@@ -418,29 +493,31 @@ Ice::ConnectionI::destroy(DestructionReason reason)
418
493
  }
419
494
 
420
495
  void
421
- Ice::ConnectionI::close(bool force)
496
+ Ice::ConnectionI::close(ConnectionClose mode)
422
497
  {
423
498
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
424
499
 
425
- if(force)
500
+ if(mode == ICE_SCOPED_ENUM(ConnectionClose, Forcefully))
501
+ {
502
+ setState(StateClosed, ConnectionManuallyClosedException(__FILE__, __LINE__, false));
503
+ }
504
+ else if(mode == ICE_SCOPED_ENUM(ConnectionClose, Gracefully))
426
505
  {
427
- setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
506
+ setState(StateClosing, ConnectionManuallyClosedException(__FILE__, __LINE__, true));
428
507
  }
429
508
  else
430
509
  {
510
+ assert(mode == ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
511
+
431
512
  //
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.
513
+ // Wait until all outstanding requests have been completed.
437
514
  //
438
- while(!_requests.empty() || !_asyncRequests.empty())
515
+ while(!_asyncRequests.empty())
439
516
  {
440
517
  wait();
441
518
  }
442
519
 
443
- setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
520
+ setState(StateClosing, ConnectionManuallyClosedException(__FILE__, __LINE__, true));
444
521
  }
445
522
  }
446
523
 
@@ -486,7 +563,7 @@ Ice::ConnectionI::throwException() const
486
563
  {
487
564
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
488
565
 
489
- if(_exception.get())
566
+ if(_exception)
490
567
  {
491
568
  assert(_state >= StateClosing);
492
569
  _exception->ice_throw();
@@ -538,10 +615,12 @@ Ice::ConnectionI::updateObserver()
538
615
  }
539
616
 
540
617
  assert(_instance->initializationData().observer);
541
- _observer.attach(_instance->initializationData().observer->getConnectionObserver(initConnectionInfo(),
542
- _endpoint,
543
- toConnectionState(_state),
544
- _observer.get()));
618
+
619
+ ConnectionObserverPtr o = _instance->initializationData().observer->getConnectionObserver(initConnectionInfo(),
620
+ _endpoint,
621
+ toConnectionState(_state),
622
+ _observer.get());
623
+ _observer.attach(o);
545
624
  }
546
625
 
547
626
  void
@@ -557,21 +636,22 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
557
636
  //
558
637
  // We send a heartbeat if there was no activity in the last
559
638
  // (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
639
+ // needed is safer to ensure that the receiver will receive the
640
+ // heartbeat in time. Sending the heartbeat if there was no
562
641
  // activity in the last (timeout / 2) period isn't enough since
563
642
  // monitor() is called only every (timeout / 2) period.
564
643
  //
565
644
  // Note that this doesn't imply that we are sending 4 heartbeats
566
- // per timeout period because the monitor() method is sill only
645
+ // per timeout period because the monitor() method is still only
567
646
  // called every (timeout / 2) period.
568
647
  //
569
- if(acm.heartbeat == HeartbeatAlways ||
570
- (acm.heartbeat != HeartbeatOff && _writeStream.b.empty() && now >= (_acmLastActivity + acm.timeout / 4)))
648
+ if(acm.heartbeat == ICE_ENUM(ACMHeartbeat, HeartbeatAlways) ||
649
+ (acm.heartbeat != ICE_ENUM(ACMHeartbeat, HeartbeatOff) &&
650
+ _writeStream.b.empty() && now >= (_acmLastActivity + acm.timeout / 4)))
571
651
  {
572
- if(acm.heartbeat != HeartbeatOnInvocation || _dispatchCount > 0)
652
+ if(acm.heartbeat != ICE_ENUM(ACMHeartbeat, HeartbeatOnDispatch) || _dispatchCount > 0)
573
653
  {
574
- heartbeat();
654
+ sendHeartbeatNow();
575
655
  }
576
656
  }
577
657
 
@@ -586,10 +666,10 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
586
666
  return;
587
667
  }
588
668
 
589
- if(acm.close != CloseOff && now >= (_acmLastActivity + acm.timeout))
669
+ if(acm.close != ICE_ENUM(ACMClose, CloseOff) && now >= (_acmLastActivity + acm.timeout))
590
670
  {
591
- if(acm.close == CloseOnIdleForceful ||
592
- (acm.close != CloseOnIdle && (!_requests.empty() || !_asyncRequests.empty())))
671
+ if(acm.close == ICE_ENUM(ACMClose, CloseOnIdleForceful) ||
672
+ (acm.close != ICE_ENUM(ACMClose, CloseOnIdle) && !_asyncRequests.empty()))
593
673
  {
594
674
  //
595
675
  // Close the connection if we didn't receive a heartbeat in
@@ -597,8 +677,8 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
597
677
  //
598
678
  setState(StateClosed, ConnectionTimeoutException(__FILE__, __LINE__));
599
679
  }
600
- else if(acm.close != CloseOnInvocation &&
601
- _dispatchCount == 0 && _batchRequestQueue->isEmpty() && _requests.empty() && _asyncRequests.empty())
680
+ else if(acm.close != ICE_ENUM(ACMClose, CloseOnInvocation) &&
681
+ _dispatchCount == 0 && _batchRequestQueue->isEmpty() && _asyncRequests.empty())
602
682
  {
603
683
  //
604
684
  // The connection is idle, close it.
@@ -608,110 +688,21 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm)
608
688
  }
609
689
  }
610
690
 
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
691
  AsyncStatus
700
692
  Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compress, bool response, int batchRequestNum)
701
693
  {
702
- BasicStream* os = out->getOs();
694
+ OutputStream* os = out->getOs();
703
695
 
704
696
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
705
- if(_exception.get())
697
+ //
698
+ // If the exception is closed before we even have a chance
699
+ // to send our request, we always try to send the request
700
+ // again.
701
+ //
702
+ if(_exception)
706
703
  {
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());
704
+ throw RetryException(*_exception);
713
705
  }
714
-
715
706
  assert(_state > StateNotValidated);
716
707
  assert(_state < StateClosing);
717
708
 
@@ -725,8 +716,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
725
716
  // Notify the request that it's cancelable with this connection.
726
717
  // This will throw if the request is canceled.
727
718
  //
728
- out->cancelable(this);
729
-
719
+ out->cancelable(ICE_SHARED_FROM_THIS);
730
720
  Int requestId = 0;
731
721
  if(response)
732
722
  {
@@ -771,7 +761,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
771
761
  catch(const LocalException& ex)
772
762
  {
773
763
  setState(StateClosed, ex);
774
- assert(_exception.get());
764
+ assert(_exception);
775
765
  _exception->ice_throw();
776
766
  }
777
767
 
@@ -792,137 +782,352 @@ Ice::ConnectionI::getBatchRequestQueue() const
792
782
  return _batchRequestQueue;
793
783
  }
794
784
 
785
+ #ifdef ICE_CPP11_MAPPING
786
+ std::function<void()>
787
+ Ice::ConnectionI::flushBatchRequestsAsync(CompressBatch compress,
788
+ ::std::function<void(::std::exception_ptr)> ex,
789
+ ::std::function<void(bool)> sent)
790
+ {
791
+ class ConnectionFlushBatchLambda : public ConnectionFlushBatchAsync, public LambdaInvoke
792
+ {
793
+ public:
794
+
795
+ ConnectionFlushBatchLambda(std::shared_ptr<Ice::ConnectionI>&& connection,
796
+ const InstancePtr& instance,
797
+ std::function<void(std::exception_ptr)> ex,
798
+ std::function<void(bool)> sent) :
799
+ ConnectionFlushBatchAsync(connection, instance), LambdaInvoke(std::move(ex), std::move(sent))
800
+ {
801
+ }
802
+ };
803
+ auto outAsync = make_shared<ConnectionFlushBatchLambda>(ICE_SHARED_FROM_THIS, _instance, ex, sent);
804
+ outAsync->invoke(flushBatchRequests_name, compress);
805
+ return [outAsync]() { outAsync->cancel(); };
806
+ }
807
+ #else
795
808
  void
796
- Ice::ConnectionI::flushBatchRequests()
809
+ Ice::ConnectionI::flushBatchRequests(CompressBatch compress)
797
810
  {
798
- ConnectionFlushBatch out(this, _instance.get(), __flushBatchRequests_name);
799
- out.invoke();
811
+ end_flushBatchRequests(begin_flushBatchRequests(compress));
800
812
  }
801
813
 
802
814
  AsyncResultPtr
803
- Ice::ConnectionI::begin_flushBatchRequests()
815
+ Ice::ConnectionI::begin_flushBatchRequests(CompressBatch compress)
804
816
  {
805
- return __begin_flushBatchRequests(__dummyCallback, 0);
817
+ return _iceI_begin_flushBatchRequests(compress, dummyCallback, 0);
806
818
  }
807
819
 
808
820
  AsyncResultPtr
809
- Ice::ConnectionI::begin_flushBatchRequests(const CallbackPtr& cb, const LocalObjectPtr& cookie)
821
+ Ice::ConnectionI::begin_flushBatchRequests(CompressBatch compress,
822
+ const CallbackPtr& cb,
823
+ const LocalObjectPtr& cookie)
810
824
  {
811
- return __begin_flushBatchRequests(cb, cookie);
825
+ return _iceI_begin_flushBatchRequests(compress, cb, cookie);
812
826
  }
813
827
 
814
828
  AsyncResultPtr
815
- Ice::ConnectionI::begin_flushBatchRequests(const Callback_Connection_flushBatchRequestsPtr& cb,
829
+ Ice::ConnectionI::begin_flushBatchRequests(CompressBatch compress,
830
+ const Callback_Connection_flushBatchRequestsPtr& cb,
816
831
  const LocalObjectPtr& cookie)
817
832
  {
818
- return __begin_flushBatchRequests(cb, cookie);
833
+ return _iceI_begin_flushBatchRequests(compress, cb, cookie);
819
834
  }
820
835
 
821
836
  AsyncResultPtr
822
- Ice::ConnectionI::begin_flushBatchRequests(const IceInternal::Function<void (const Exception&)>& exception,
823
- const IceInternal::Function<void (bool)>& sent)
837
+ Ice::ConnectionI::_iceI_begin_flushBatchRequests(CompressBatch compress,
838
+ const CallbackBasePtr& cb,
839
+ const LocalObjectPtr& cookie)
824
840
  {
825
- #ifdef ICE_CPP11
826
- class Cpp11CB : public IceInternal::Cpp11FnCallbackNC
841
+ class ConnectionFlushBatchAsyncWithCallback : public ConnectionFlushBatchAsync, public CallbackCompletion
827
842
  {
828
843
  public:
829
844
 
830
- Cpp11CB(const IceInternal::Function<void (const Exception&)>& excb,
831
- const IceInternal::Function<void (bool)>& sentcb) :
832
- IceInternal::Cpp11FnCallbackNC(excb, sentcb)
845
+ ConnectionFlushBatchAsyncWithCallback(const Ice::ConnectionIPtr& connection,
846
+ const Ice::CommunicatorPtr& communicator,
847
+ const InstancePtr& instance,
848
+ const CallbackBasePtr& callback,
849
+ const Ice::LocalObjectPtr& cookie) :
850
+ ConnectionFlushBatchAsync(connection, instance),
851
+ CallbackCompletion(callback, cookie),
852
+ _communicator(communicator),
853
+ _connection(connection)
854
+ {
855
+ _cookie = cookie;
856
+ }
857
+
858
+ virtual Ice::CommunicatorPtr getCommunicator() const
859
+ {
860
+ return _communicator;
861
+ }
862
+
863
+ virtual Ice::ConnectionPtr getConnection() const
833
864
  {
834
- CallbackBase::checkCallback(true, excb != nullptr);
865
+ return _connection;
835
866
  }
836
867
 
837
- virtual void
838
- completed(const AsyncResultPtr& __result) const
868
+ virtual const std::string&
869
+ getOperation() const
839
870
  {
840
- ConnectionPtr __con = __result->getConnection();
841
- assert(__con);
842
- try
871
+ return flushBatchRequests_name;
872
+ }
873
+
874
+ private:
875
+
876
+ Ice::CommunicatorPtr _communicator;
877
+ Ice::ConnectionPtr _connection;
878
+ };
879
+
880
+ ConnectionFlushBatchAsyncPtr result = new ConnectionFlushBatchAsyncWithCallback(this,
881
+ _communicator,
882
+ _instance,
883
+ cb,
884
+ cookie);
885
+ result->invoke(flushBatchRequests_name, compress);
886
+ return result;
887
+ }
888
+
889
+ void
890
+ Ice::ConnectionI::end_flushBatchRequests(const AsyncResultPtr& r)
891
+ {
892
+ AsyncResult::_check(r, this, flushBatchRequests_name);
893
+ r->_waitForResponse();
894
+ }
895
+ #endif
896
+
897
+ namespace
898
+ {
899
+
900
+ const ::std::string heartbeat_name = "heartbeat";
901
+
902
+ class HeartbeatAsync : public OutgoingAsyncBase
903
+ {
904
+ public:
905
+
906
+ HeartbeatAsync(const ConnectionIPtr& connection,
907
+ const CommunicatorPtr& communicator,
908
+ const InstancePtr& instance) :
909
+ OutgoingAsyncBase(instance),
910
+ _communicator(communicator),
911
+ _connection(connection)
912
+ {
913
+ }
914
+
915
+ virtual CommunicatorPtr getCommunicator() const
916
+ {
917
+ return _communicator;
918
+ }
919
+
920
+ virtual ConnectionPtr getConnection() const
921
+ {
922
+ return _connection;
923
+ }
924
+
925
+ virtual const string& getOperation() const
926
+ {
927
+ return heartbeat_name;
928
+ }
929
+
930
+ void invoke()
931
+ {
932
+ _observer.attach(_instance.get(), heartbeat_name);
933
+ try
934
+ {
935
+ _os.write(magic[0]);
936
+ _os.write(magic[1]);
937
+ _os.write(magic[2]);
938
+ _os.write(magic[3]);
939
+ _os.write(currentProtocol);
940
+ _os.write(currentProtocolEncoding);
941
+ _os.write(validateConnectionMsg);
942
+ _os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
943
+ _os.write(headerSize); // Message size.
944
+ _os.i = _os.b.begin();
945
+
946
+ AsyncStatus status = _connection->sendAsyncRequest(ICE_SHARED_FROM_THIS, false, false, 0);
947
+ if(status & AsyncStatusSent)
948
+ {
949
+ _sentSynchronously = true;
950
+ if(status & AsyncStatusInvokeSentCallback)
951
+ {
952
+ invokeSent();
953
+ }
954
+ }
955
+ }
956
+ catch(const RetryException& ex)
957
+ {
958
+ if(exception(*ex.get()))
843
959
  {
844
- __con->end_flushBatchRequests(__result);
845
- assert(false);
960
+ invokeExceptionAsync();
846
961
  }
847
- catch(const Exception& ex)
962
+ }
963
+ catch(const Exception& ex)
964
+ {
965
+ if(exception(ex))
848
966
  {
849
- IceInternal::Cpp11FnCallbackNC::exception(__result, ex);
967
+ invokeExceptionAsync();
850
968
  }
851
969
  }
852
- };
970
+ }
971
+
972
+ private:
973
+
974
+ CommunicatorPtr _communicator;
975
+ ConnectionIPtr _connection;
976
+ };
977
+ typedef IceUtil::Handle<HeartbeatAsync> HeartbeatAsyncPtr;
978
+
979
+ }
853
980
 
854
- return __begin_flushBatchRequests(new Cpp11CB(exception, sent), 0);
981
+ #ifdef ICE_CPP11_MAPPING
982
+ void
983
+ Ice::ConnectionI::heartbeat()
984
+ {
985
+ Connection::heartbeatAsync().get();
986
+ }
987
+
988
+ std::function<void()>
989
+ Ice::ConnectionI::heartbeatAsync(::std::function<void(::std::exception_ptr)> ex, ::std::function<void(bool)> sent)
990
+ {
991
+ class HeartbeatLambda : public HeartbeatAsync, public LambdaInvoke
992
+ {
993
+ public:
994
+
995
+ HeartbeatLambda(std::shared_ptr<Ice::ConnectionI>&& connection,
996
+ std::shared_ptr<Ice::Communicator>& communicator,
997
+ const InstancePtr& instance,
998
+ std::function<void(std::exception_ptr)> ex,
999
+ std::function<void(bool)> sent) :
1000
+ HeartbeatAsync(connection, communicator, instance), LambdaInvoke(std::move(ex), std::move(sent))
1001
+ {
1002
+ }
1003
+ };
1004
+ auto outAsync = make_shared<HeartbeatLambda>(ICE_SHARED_FROM_THIS, _communicator, _instance, ex, sent);
1005
+ outAsync->invoke();
1006
+ return [outAsync]() { outAsync->cancel(); };
1007
+ }
855
1008
  #else
856
- assert(false); // Ice not built with C++11 support.
857
- return 0;
858
- #endif
1009
+ void
1010
+ Ice::ConnectionI::heartbeat()
1011
+ {
1012
+ end_heartbeat(begin_heartbeat());
1013
+ }
1014
+
1015
+ AsyncResultPtr
1016
+ Ice::ConnectionI::begin_heartbeat()
1017
+ {
1018
+ return _iceI_begin_heartbeat(dummyCallback, 0);
859
1019
  }
860
1020
 
861
1021
  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);
1022
+ Ice::ConnectionI::begin_heartbeat(const CallbackPtr& cb, const LocalObjectPtr& cookie)
1023
+ {
1024
+ return _iceI_begin_heartbeat(cb, cookie);
1025
+ }
1026
+
1027
+ AsyncResultPtr
1028
+ Ice::ConnectionI::begin_heartbeat(const Callback_Connection_heartbeatPtr& cb, const LocalObjectPtr& cookie)
1029
+ {
1030
+ return _iceI_begin_heartbeat(cb, cookie);
1031
+ }
1032
+
1033
+ AsyncResultPtr
1034
+ Ice::ConnectionI::_iceI_begin_heartbeat(const CallbackBasePtr& cb, const LocalObjectPtr& cookie)
1035
+ {
1036
+ class HeartbeatCallback : public HeartbeatAsync, public CallbackCompletion
1037
+ {
1038
+ public:
1039
+
1040
+ HeartbeatCallback(const ConnectionIPtr& connection,
1041
+ const CommunicatorPtr& communicator,
1042
+ const InstancePtr& instance,
1043
+ const CallbackBasePtr& callback,
1044
+ const LocalObjectPtr& cookie) :
1045
+ HeartbeatAsync(connection, communicator, instance),
1046
+ CallbackCompletion(callback, cookie)
1047
+ {
1048
+ _cookie = cookie;
1049
+ }
1050
+ };
1051
+
1052
+ HeartbeatAsyncPtr result = new HeartbeatCallback(this, _communicator, _instance, cb, cookie);
870
1053
  result->invoke();
871
1054
  return result;
872
1055
  }
873
1056
 
874
1057
  void
875
- Ice::ConnectionI::end_flushBatchRequests(const AsyncResultPtr& r)
1058
+ Ice::ConnectionI::end_heartbeat(const AsyncResultPtr& r)
876
1059
  {
877
- AsyncResult::__check(r, this, __flushBatchRequests_name);
878
- r->__wait();
1060
+ AsyncResult::_check(r, this, heartbeat_name);
1061
+ r->_waitForResponse();
879
1062
  }
1063
+ #endif
880
1064
 
881
1065
  void
882
- Ice::ConnectionI::setCallback(const ConnectionCallbackPtr& callback)
1066
+ Ice::ConnectionI::setHeartbeatCallback(ICE_IN(ICE_DELEGATE(HeartbeatCallback)) callback)
883
1067
  {
1068
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1069
+ if(_state >= StateClosed)
884
1070
  {
885
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
886
- if(_state >= StateClosed)
1071
+ return;
1072
+ }
1073
+ _heartbeatCallback = callback;
1074
+ }
1075
+
1076
+ void
1077
+ Ice::ConnectionI::setCloseCallback(ICE_IN(ICE_DELEGATE(CloseCallback)) callback)
1078
+ {
1079
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1080
+ if(_state >= StateClosed)
1081
+ {
1082
+ if(callback)
887
1083
  {
888
- if(callback)
1084
+ class CallbackWorkItem : public DispatchWorkItem
889
1085
  {
890
- class CallbackWorkItem : public DispatchWorkItem
891
- {
892
- public:
1086
+ public:
893
1087
 
894
- CallbackWorkItem(const ConnectionIPtr& connection, const ConnectionCallbackPtr& callback) :
895
- _connection(connection),
896
- _callback(callback)
897
- {
898
- }
1088
+ CallbackWorkItem(const ConnectionIPtr& connection, ICE_IN(ICE_DELEGATE(CloseCallback)) callback) :
1089
+ _connection(connection),
1090
+ #ifdef ICE_CPP11_MAPPING
1091
+ _callback(move(callback))
1092
+ #else
1093
+ _callback(callback)
1094
+ #endif
1095
+ {
1096
+ }
899
1097
 
900
- virtual void run()
901
- {
902
- _connection->closeCallback(_callback);
903
- }
1098
+ virtual void run()
1099
+ {
1100
+ _connection->closeCallback(_callback);
1101
+ }
904
1102
 
905
- private:
1103
+ private:
906
1104
 
907
- const ConnectionIPtr _connection;
908
- const ConnectionCallbackPtr _callback;
909
- };
910
- _threadPool->dispatch(new CallbackWorkItem(this, callback));
911
- }
912
- }
913
- else
914
- {
915
- _callback = callback;
1105
+ const ConnectionIPtr _connection;
1106
+ const ICE_DELEGATE(CloseCallback) _callback;
1107
+ };
1108
+ #ifdef ICE_CPP11_MAPPING
1109
+ _threadPool->dispatch(new CallbackWorkItem(ICE_SHARED_FROM_THIS, move(callback)));
1110
+ #else
1111
+ _threadPool->dispatch(new CallbackWorkItem(ICE_SHARED_FROM_THIS, callback));
1112
+ #endif
916
1113
  }
917
1114
  }
1115
+ else
1116
+ {
1117
+ _closeCallback = callback;
1118
+ }
918
1119
  }
919
1120
 
920
1121
  void
921
- Ice::ConnectionI::closeCallback(const ConnectionCallbackPtr& callback)
1122
+ Ice::ConnectionI::closeCallback(const ICE_DELEGATE(CloseCallback)& callback)
922
1123
  {
923
1124
  try
924
1125
  {
925
- callback->closed(this);
1126
+ #ifdef ICE_CPP11_MAPPING
1127
+ callback(ICE_SHARED_FROM_THIS);
1128
+ #else
1129
+ callback->closed(ICE_SHARED_FROM_THIS);
1130
+ #endif
926
1131
  }
927
1132
  catch(const std::exception& ex)
928
1133
  {
@@ -945,130 +1150,40 @@ Ice::ConnectionI::setACM(const IceUtil::Optional<int>& timeout,
945
1150
  if(!_monitor || _state >= StateClosed)
946
1151
  {
947
1152
  return;
948
- }
949
-
950
- if(_state == StateActive)
951
- {
952
- _monitor->remove(this);
953
- }
954
- _monitor = _monitor->acm(timeout, close, heartbeat);
955
-
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
- }
964
-
965
- if(_state == StateActive)
966
- {
967
- _monitor->add(this);
968
- }
969
- }
970
-
971
- ACM
972
- Ice::ConnectionI::getACM()
973
- {
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;
980
- }
981
-
982
- void
983
- Ice::ConnectionI::requestCanceled(OutgoingBase* out, const Ice::LocalException& ex)
984
- {
985
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
986
- if(_state >= StateClosed)
987
- {
988
- return; // The request has already been or will be shortly notified of the failure.
989
- }
990
-
991
- for(deque<OutgoingMessage>::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o)
992
- {
993
- if(o->out == out)
994
- {
995
- if(o->requestId)
996
- {
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
- }
1153
+ }
1007
1154
 
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())
1019
- {
1020
- o->canceled(true); // true = adopt the stream.
1021
- }
1022
- else
1023
- {
1024
- o->canceled(false);
1025
- _sendStreams.erase(o);
1026
- }
1027
- out->completed(ex);
1028
- }
1029
- return;
1030
- }
1155
+ if(_state == StateActive)
1156
+ {
1157
+ _monitor->remove(ICE_SHARED_FROM_THIS);
1031
1158
  }
1159
+ _monitor = _monitor->acm(timeout, close, heartbeat);
1032
1160
 
1033
- if(dynamic_cast<Outgoing*>(out))
1161
+ if(_monitor->getACM().timeout <= 0)
1034
1162
  {
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
- }
1163
+ _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity.
1164
+ }
1165
+ else if(_acmLastActivity == IceUtil::Time() && _state == StateActive)
1166
+ {
1167
+ _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
1168
+ }
1169
+
1170
+ if(_state == StateActive)
1171
+ {
1172
+ _monitor->add(ICE_SHARED_FROM_THIS);
1069
1173
  }
1070
1174
  }
1071
1175
 
1176
+ ACM
1177
+ Ice::ConnectionI::getACM()
1178
+ {
1179
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1180
+ ACM acm;
1181
+ acm.timeout = 0;
1182
+ acm.close = ICE_ENUM(ACMClose, CloseOff);
1183
+ acm.heartbeat = ICE_ENUM(ACMHeartbeat, HeartbeatOff);
1184
+ return _monitor ? _monitor->getACM() : acm;
1185
+ }
1186
+
1072
1187
  void
1073
1188
  Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, const LocalException& ex)
1074
1189
  {
@@ -1089,7 +1204,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1089
1204
  if(o->requestId)
1090
1205
  {
1091
1206
  if(_asyncRequestsHint != _asyncRequests.end() &&
1092
- _asyncRequestsHint->second == OutgoingAsyncPtr::dynamicCast(outAsync))
1207
+ _asyncRequestsHint->second == ICE_DYNAMIC_CAST(OutgoingAsync, outAsync))
1093
1208
  {
1094
1209
  _asyncRequests.erase(_asyncRequestsHint);
1095
1210
  _asyncRequestsHint = _asyncRequests.end();
@@ -1119,16 +1234,16 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1119
1234
  o->canceled(false);
1120
1235
  _sendStreams.erase(o);
1121
1236
  }
1122
- if(outAsync->completed(ex))
1237
+ if(outAsync->exception(ex))
1123
1238
  {
1124
- outAsync->invokeCompletedAsync();
1239
+ outAsync->invokeExceptionAsync();
1125
1240
  }
1126
1241
  }
1127
1242
  return;
1128
1243
  }
1129
1244
  }
1130
1245
 
1131
- if(OutgoingAsyncPtr::dynamicCast(outAsync))
1246
+ if(ICE_DYNAMIC_CAST(OutgoingAsync, outAsync))
1132
1247
  {
1133
1248
  if(_asyncRequestsHint != _asyncRequests.end())
1134
1249
  {
@@ -1142,9 +1257,9 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1142
1257
  {
1143
1258
  _asyncRequests.erase(_asyncRequestsHint);
1144
1259
  _asyncRequestsHint = _asyncRequests.end();
1145
- if(outAsync->completed(ex))
1260
+ if(outAsync->exception(ex))
1146
1261
  {
1147
- outAsync->invokeCompletedAsync();
1262
+ outAsync->invokeExceptionAsync();
1148
1263
  }
1149
1264
  }
1150
1265
  return;
@@ -1163,9 +1278,9 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1163
1278
  {
1164
1279
  assert(p != _asyncRequestsHint);
1165
1280
  _asyncRequests.erase(p);
1166
- if(outAsync->completed(ex))
1281
+ if(outAsync->exception(ex))
1167
1282
  {
1168
- outAsync->invokeCompletedAsync();
1283
+ outAsync->invokeExceptionAsync();
1169
1284
  }
1170
1285
  }
1171
1286
  return;
@@ -1175,7 +1290,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, con
1175
1290
  }
1176
1291
 
1177
1292
  void
1178
- Ice::ConnectionI::sendResponse(Int, BasicStream* os, Byte compressFlag, bool /*amd*/)
1293
+ Ice::ConnectionI::sendResponse(Int, OutputStream* os, Byte compressFlag, bool /*amd*/)
1179
1294
  {
1180
1295
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1181
1296
  assert(_state > StateNotValidated);
@@ -1193,7 +1308,7 @@ Ice::ConnectionI::sendResponse(Int, BasicStream* os, Byte compressFlag, bool /*a
1193
1308
 
1194
1309
  if(_state >= StateClosed)
1195
1310
  {
1196
- assert(_exception.get());
1311
+ assert(_exception);
1197
1312
  _exception->ice_throw();
1198
1313
  }
1199
1314
 
@@ -1232,7 +1347,7 @@ Ice::ConnectionI::sendNoResponse()
1232
1347
 
1233
1348
  if(_state >= StateClosed)
1234
1349
  {
1235
- assert(_exception.get());
1350
+ assert(_exception);
1236
1351
  _exception->ice_throw();
1237
1352
  }
1238
1353
 
@@ -1335,18 +1450,18 @@ Ice::ConnectionI::getEndpoint() const
1335
1450
  return _endpoint; // No mutex protection necessary, _endpoint is immutable.
1336
1451
  }
1337
1452
 
1338
- ObjectPrx
1453
+ ObjectPrxPtr
1339
1454
  Ice::ConnectionI::createProxy(const Identity& ident) const
1340
1455
  {
1341
1456
  //
1342
1457
  // Create a reference and return a reverse proxy for this
1343
1458
  // reference.
1344
1459
  //
1345
- ConnectionIPtr self = const_cast<ConnectionI*>(this);
1346
- return _instance->proxyFactory()->referenceToProxy(_instance->referenceFactory()->create(ident, self));
1460
+ return _instance->proxyFactory()->referenceToProxy(
1461
+ _instance->referenceFactory()->create(ident, ICE_SHARED_FROM_CONST_THIS(ConnectionI)));
1347
1462
  }
1348
1463
 
1349
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
1464
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
1350
1465
  bool
1351
1466
  Ice::ConnectionI::startAsync(SocketOperation operation)
1352
1467
  {
@@ -1372,19 +1487,12 @@ Ice::ConnectionI::startAsync(SocketOperation operation)
1372
1487
  }
1373
1488
  else if(operation & SocketOperationRead)
1374
1489
  {
1375
- if(!_hasMoreData)
1376
- {
1377
- if(_observer && !_readHeader)
1378
- {
1379
- _observer.startRead(_readStream);
1380
- }
1381
-
1382
- _transceiver->startRead(_readStream);
1383
- }
1384
- else
1490
+ if(_observer && !_readHeader)
1385
1491
  {
1386
- _transceiver->getNativeInfo()->completed(IceInternal::SocketOperationRead);
1492
+ _observer.startRead(_readStream);
1387
1493
  }
1494
+
1495
+ _transceiver->startRead(_readStream);
1388
1496
  }
1389
1497
  }
1390
1498
  catch(const Ice::LocalException& ex)
@@ -1422,29 +1530,26 @@ Ice::ConnectionI::finishAsync(SocketOperation operation)
1422
1530
  }
1423
1531
  else if(operation & SocketOperationRead)
1424
1532
  {
1425
- if(!_hasMoreData)
1533
+ Buffer::Container::iterator start = _readStream.i;
1534
+ _transceiver->finishRead(_readStream);
1535
+ if(_instance->traceLevels()->network >= 3 && _readStream.i != start)
1426
1536
  {
1427
- Buffer::Container::iterator start = _readStream.i;
1428
- _transceiver->finishRead(_readStream, _hasMoreData);
1429
- if(_instance->traceLevels()->network >= 3 && _readStream.i != start)
1537
+ Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
1538
+ out << "received ";
1539
+ if(_endpoint->datagram())
1430
1540
  {
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();
1541
+ out << _readStream.b.size();
1442
1542
  }
1443
-
1444
- if(_observer && !_readHeader)
1543
+ else
1445
1544
  {
1446
- _observer.finishRead(_readStream);
1545
+ out << (_readStream.i - start) << " of " << (_readStream.b.end() - start);
1447
1546
  }
1547
+ out << " bytes via " << _endpoint->protocol() << "\n" << toString();
1548
+ }
1549
+
1550
+ if(_observer && !_readHeader)
1551
+ {
1552
+ _observer.finishRead(_readStream);
1448
1553
  }
1449
1554
  }
1450
1555
  }
@@ -1467,11 +1572,10 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1467
1572
  ServantManagerPtr servantManager;
1468
1573
  ObjectAdapterPtr adapter;
1469
1574
  OutgoingAsyncBasePtr outAsync;
1470
- ConnectionCallbackPtr heartbeatCallback;
1575
+ ICE_DELEGATE(HeartbeatCallback) heartbeatCallback;
1471
1576
  int dispatchCount = 0;
1472
1577
 
1473
1578
  ThreadPoolMessage<ConnectionI> msg(current, *this);
1474
-
1475
1579
  {
1476
1580
  IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
1477
1581
 
@@ -1603,7 +1707,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1603
1707
  // satisfied before continuing.
1604
1708
  //
1605
1709
  scheduleTimeout(newOp);
1606
- _threadPool->update(this, current.operation, newOp);
1710
+ _threadPool->update(ICE_SHARED_FROM_THIS, current.operation, newOp);
1607
1711
  return;
1608
1712
  }
1609
1713
 
@@ -1617,7 +1721,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1617
1721
  return;
1618
1722
  }
1619
1723
 
1620
- _threadPool->unregister(this, current.operation);
1724
+ _threadPool->unregister(ICE_SHARED_FROM_THIS, current.operation);
1621
1725
 
1622
1726
  //
1623
1727
  // We start out in holding state.
@@ -1665,7 +1769,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1665
1769
  if(_state < StateClosed)
1666
1770
  {
1667
1771
  scheduleTimeout(newOp);
1668
- _threadPool->update(this, current.operation, newOp);
1772
+ _threadPool->update(ICE_SHARED_FROM_THIS, current.operation, newOp);
1669
1773
  }
1670
1774
  }
1671
1775
 
@@ -1727,9 +1831,10 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
1727
1831
  }
1728
1832
  else
1729
1833
  {
1730
- _threadPool->dispatchFromThisThread(new DispatchCall(this, startCB, sentCBs, compress, requestId, invokeNum,
1731
- servantManager, adapter, outAsync, heartbeatCallback,
1732
- current.stream));
1834
+ _threadPool->dispatchFromThisThread(new DispatchCall(ICE_SHARED_FROM_THIS, startCB, sentCBs, compress, requestId,
1835
+ invokeNum, servantManager, adapter, outAsync,
1836
+ heartbeatCallback, current.stream));
1837
+
1733
1838
  }
1734
1839
  }
1735
1840
 
@@ -1737,7 +1842,7 @@ void
1737
1842
  ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingMessage>& sentCBs,
1738
1843
  Byte compress, Int requestId, Int invokeNum, const ServantManagerPtr& servantManager,
1739
1844
  const ObjectAdapterPtr& adapter, const OutgoingAsyncBasePtr& outAsync,
1740
- const ConnectionCallbackPtr& heartbeatCallback, BasicStream& stream)
1845
+ const ICE_DELEGATE(HeartbeatCallback)& heartbeatCallback, InputStream& stream)
1741
1846
  {
1742
1847
  int dispatchedCount = 0;
1743
1848
 
@@ -1747,7 +1852,7 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingMess
1747
1852
  //
1748
1853
  if(startCB)
1749
1854
  {
1750
- startCB->connectionStartCompleted(this);
1855
+ startCB->connectionStartCompleted(ICE_SHARED_FROM_THIS);
1751
1856
  ++dispatchedCount;
1752
1857
  }
1753
1858
 
@@ -1758,17 +1863,17 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingMess
1758
1863
  {
1759
1864
  for(vector<OutgoingMessage>::const_iterator p = sentCBs.begin(); p != sentCBs.end(); ++p)
1760
1865
  {
1761
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
1866
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
1762
1867
  if(p->invokeSent)
1763
1868
  {
1764
1869
  p->outAsync->invokeSent();
1765
1870
  }
1766
1871
  if(p->receivedReply)
1767
1872
  {
1768
- OutgoingAsyncPtr outAsync = OutgoingAsyncPtr::dynamicCast(p->outAsync);
1769
- if(outAsync->completed())
1873
+ OutgoingAsyncPtr o = ICE_DYNAMIC_CAST(OutgoingAsync, p->outAsync);
1874
+ if(o->response())
1770
1875
  {
1771
- outAsync->invokeCompleted();
1876
+ o->invokeResponse();
1772
1877
  }
1773
1878
  }
1774
1879
  #else
@@ -1784,7 +1889,7 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingMess
1784
1889
  //
1785
1890
  if(outAsync)
1786
1891
  {
1787
- outAsync->invokeCompleted();
1892
+ outAsync->invokeResponse();
1788
1893
  ++dispatchedCount;
1789
1894
  }
1790
1895
 
@@ -1792,7 +1897,11 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingMess
1792
1897
  {
1793
1898
  try
1794
1899
  {
1795
- heartbeatCallback->heartbeat(this);
1900
+ #ifdef ICE_CPP11_MAPPING
1901
+ heartbeatCallback(ICE_SHARED_FROM_THIS);
1902
+ #else
1903
+ heartbeatCallback->heartbeat(ICE_SHARED_FROM_THIS);
1904
+ #endif
1796
1905
  }
1797
1906
  catch(const std::exception& ex)
1798
1907
  {
@@ -1871,7 +1980,7 @@ Ice::ConnectionI::finished(ThreadPoolCurrent& current, bool close)
1871
1980
  // to call code that will potentially block (this avoids promoting a new leader and
1872
1981
  // unecessary thread creation, especially if this is called on shutdown).
1873
1982
  //
1874
- if(!_startCallback && _sendStreams.empty() && _asyncRequests.empty() && !_callback)
1983
+ if(!_startCallback && _sendStreams.empty() && _asyncRequests.empty() && !_closeCallback && !_heartbeatCallback)
1875
1984
  {
1876
1985
  finish(close);
1877
1986
  return;
@@ -1884,7 +1993,7 @@ Ice::ConnectionI::finished(ThreadPoolCurrent& current, bool close)
1884
1993
  }
1885
1994
  else
1886
1995
  {
1887
- _threadPool->dispatchFromThisThread(new FinishCall(this, close));
1996
+ _threadPool->dispatchFromThisThread(new FinishCall(ICE_SHARED_FROM_THIS, close));
1888
1997
  }
1889
1998
  }
1890
1999
 
@@ -1897,8 +2006,9 @@ Ice::ConnectionI::finish(bool close)
1897
2006
  {
1898
2007
  string verb = _connector ? "establish" : "accept";
1899
2008
  Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
2009
+
1900
2010
  out << "failed to " << verb << " " << _endpoint->protocol() << " connection\n" << toString()
1901
- << "\n" << *_exception.get();
2011
+ << "\n" << *_exception;
1902
2012
  }
1903
2013
  }
1904
2014
  else
@@ -1908,28 +2018,35 @@ Ice::ConnectionI::finish(bool close)
1908
2018
  Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
1909
2019
  out << "closed " << _endpoint->protocol() << " connection\n" << toString();
1910
2020
 
1911
- //
1912
- // Trace the cause of unexpected connection closures
1913
- //
1914
2021
  if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
1915
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
2022
+ dynamic_cast<const ConnectionManuallyClosedException*>(_exception.get()) ||
1916
2023
  dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
1917
2024
  dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
1918
2025
  dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get())))
1919
2026
  {
1920
- out << "\n" << *_exception.get();
2027
+ out << "\n" << *_exception;
1921
2028
  }
1922
2029
  }
1923
2030
  }
1924
2031
 
1925
2032
  if(close)
1926
2033
  {
1927
- _transceiver->close();
2034
+ try
2035
+ {
2036
+ _transceiver->close();
2037
+ }
2038
+ catch(const Ice::LocalException& ex)
2039
+ {
2040
+ Error out(_logger);
2041
+ out << "unexpected connection exception:\n" << ex << '\n' << _desc;
2042
+ }
1928
2043
  }
1929
2044
 
1930
2045
  if(_startCallback)
1931
2046
  {
1932
- _startCallback->connectionStartFailed(this, *_exception.get());
2047
+ assert(_exception);
2048
+
2049
+ _startCallback->connectionStartFailed(ICE_SHARED_FROM_THIS, *_exception);
1933
2050
  _startCallback = 0;
1934
2051
  }
1935
2052
 
@@ -1944,7 +2061,7 @@ Ice::ConnectionI::finish(bool close)
1944
2061
  OutgoingMessage* message = &_sendStreams.front();
1945
2062
  _writeStream.swap(*message->stream);
1946
2063
 
1947
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
2064
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
1948
2065
  //
1949
2066
  // The current message might be sent but not yet removed from _sendStreams. If
1950
2067
  // the response has been received in the meantime, we remove the message from
@@ -1958,10 +2075,10 @@ Ice::ConnectionI::finish(bool close)
1958
2075
  }
1959
2076
  if(message->receivedReply)
1960
2077
  {
1961
- OutgoingAsyncPtr outAsync = OutgoingAsyncPtr::dynamicCast(message->outAsync);
1962
- if(outAsync->completed())
2078
+ OutgoingAsyncPtr outAsync = ICE_DYNAMIC_CAST(OutgoingAsync, message->outAsync);
2079
+ if(outAsync->response())
1963
2080
  {
1964
- outAsync->invokeCompleted();
2081
+ outAsync->invokeResponse();
1965
2082
  }
1966
2083
  }
1967
2084
  _sendStreams.pop_front();
@@ -1971,35 +2088,24 @@ Ice::ConnectionI::finish(bool close)
1971
2088
 
1972
2089
  for(deque<OutgoingMessage>::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o)
1973
2090
  {
1974
- o->completed(*_exception.get());
2091
+ o->completed(*_exception);
1975
2092
  if(o->requestId) // Make sure finished isn't called twice.
1976
2093
  {
1977
- if(o->out)
1978
- {
1979
- _requests.erase(o->requestId);
1980
- }
1981
- else
1982
- {
1983
- _asyncRequests.erase(o->requestId);
1984
- }
2094
+ _asyncRequests.erase(o->requestId);
1985
2095
  }
1986
2096
  }
1987
- _sendStreams.clear(); // Must be cleared before _requests because of Outgoing* references in OutgoingMessage
1988
- }
1989
2097
 
1990
- for(map<Int, OutgoingBase*>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
1991
- {
1992
- p->second->completed(*_exception.get());
2098
+ _sendStreams.clear();
1993
2099
  }
1994
- _requests.clear();
1995
2100
 
1996
2101
  for(map<Int, OutgoingAsyncBasePtr>::const_iterator q = _asyncRequests.begin(); q != _asyncRequests.end(); ++q)
1997
2102
  {
1998
- if(q->second->completed(*_exception.get()))
2103
+ if(q->second->exception(*_exception))
1999
2104
  {
2000
- q->second->invokeCompleted();
2105
+ q->second->invokeException();
2001
2106
  }
2002
2107
  }
2108
+
2003
2109
  _asyncRequests.clear();
2004
2110
 
2005
2111
  //
@@ -2010,12 +2116,14 @@ Ice::ConnectionI::finish(bool close)
2010
2116
  _readStream.clear();
2011
2117
  _readStream.b.clear();
2012
2118
 
2013
- if(_callback)
2119
+ if(_closeCallback)
2014
2120
  {
2015
- closeCallback(_callback);
2016
- _callback = 0;
2121
+ closeCallback(_closeCallback);
2122
+ _closeCallback = ICE_NULLPTR;
2017
2123
  }
2018
2124
 
2125
+ _heartbeatCallback = ICE_NULLPTR;
2126
+
2019
2127
  //
2020
2128
  // This must be done last as this will cause waitUntilFinished() to return (and communicator
2021
2129
  // objects such as the timer might be destroyed too).
@@ -2131,7 +2239,6 @@ Ice::ConnectionI::ConnectionI(const CommunicatorPtr& communicator,
2131
2239
  _warnUdp(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0),
2132
2240
  _compressionLevel(1),
2133
2241
  _nextRequestId(1),
2134
- _requestsHint(_requests.end()),
2135
2242
  _asyncRequestsHint(_asyncRequests.end()),
2136
2243
  _messageSizeMax(adapter ? adapter->messageSizeMax() : _instance->messageSizeMax()),
2137
2244
  _batchRequestQueue(new BatchRequestQueue(instance, endpoint->datagram())),
@@ -2166,36 +2273,39 @@ Ice::ConnectionI::ConnectionI(const CommunicatorPtr& communicator,
2166
2273
  {
2167
2274
  _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
2168
2275
  }
2276
+ }
2169
2277
 
2170
- __setNoDelete(true);
2171
- try
2278
+ Ice::ConnectionIPtr
2279
+ Ice::ConnectionI::create(const CommunicatorPtr& communicator,
2280
+ const InstancePtr& instance,
2281
+ const ACMMonitorPtr& monitor,
2282
+ const TransceiverPtr& transceiver,
2283
+ const ConnectorPtr& connector,
2284
+ const EndpointIPtr& endpoint,
2285
+ const ObjectAdapterIPtr& adapter)
2286
+ {
2287
+ Ice::ConnectionIPtr conn(new ConnectionI(communicator, instance, monitor, transceiver, connector,
2288
+ endpoint, adapter));
2289
+ if(adapter)
2172
2290
  {
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);
2291
+ const_cast<ThreadPoolPtr&>(conn->_threadPool) = adapter->getThreadPool();
2182
2292
  }
2183
- catch(const IceUtil::Exception&)
2293
+ else
2184
2294
  {
2185
- __setNoDelete(false);
2186
- throw;
2295
+ const_cast<ThreadPoolPtr&>(conn->_threadPool) = conn->_instance->clientThreadPool();
2187
2296
  }
2188
- __setNoDelete(false);
2297
+ conn->_threadPool->initialize(conn);
2298
+ return conn;
2189
2299
  }
2190
2300
 
2191
2301
  Ice::ConnectionI::~ConnectionI()
2192
2302
  {
2193
2303
  assert(!_startCallback);
2194
- assert(!_callback);
2304
+ assert(!_closeCallback);
2305
+ assert(!_heartbeatCallback);
2195
2306
  assert(_state == StateFinished);
2196
2307
  assert(_dispatchCount == 0);
2197
2308
  assert(_sendStreams.empty());
2198
- assert(_requests.empty());
2199
2309
  assert(_asyncRequests.empty());
2200
2310
  }
2201
2311
 
@@ -2213,15 +2323,13 @@ Ice::ConnectionI::setState(State state, const LocalException& ex)
2213
2323
  return;
2214
2324
  }
2215
2325
 
2216
- if(!_exception.get())
2326
+ if(!_exception)
2217
2327
  {
2218
2328
  //
2219
2329
  // If we are in closed state, an exception must be set.
2220
2330
  //
2221
2331
  assert(_state != StateClosed);
2222
-
2223
- _exception.reset(ex.ice_clone());
2224
-
2332
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
2225
2333
  //
2226
2334
  // We don't warn if we are not validated.
2227
2335
  //
@@ -2230,15 +2338,15 @@ Ice::ConnectionI::setState(State state, const LocalException& ex)
2230
2338
  //
2231
2339
  // Don't warn about certain expected exceptions.
2232
2340
  //
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)))
2341
+ if(!(dynamic_cast<const CloseConnectionException*>(&ex) ||
2342
+ dynamic_cast<const ConnectionManuallyClosedException*>(&ex) ||
2343
+ dynamic_cast<const ConnectionTimeoutException*>(&ex) ||
2344
+ dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
2345
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) ||
2346
+ (dynamic_cast<const ConnectionLostException*>(&ex) && _state >= StateClosing)))
2239
2347
  {
2240
2348
  Warning out(_logger);
2241
- out << "connection exception:\n" << *_exception.get() << '\n' << _desc;
2349
+ out << "connection exception:\n" << ex << '\n' << _desc;
2242
2350
  }
2243
2351
  }
2244
2352
  }
@@ -2280,92 +2388,92 @@ Ice::ConnectionI::setState(State state)
2280
2388
  {
2281
2389
  switch(state)
2282
2390
  {
2283
- case StateNotInitialized:
2284
- {
2285
- assert(false);
2286
- break;
2287
- }
2288
-
2289
- case StateNotValidated:
2290
- {
2291
- if(_state != StateNotInitialized)
2391
+ case StateNotInitialized:
2292
2392
  {
2293
- assert(_state == StateClosed);
2294
- return;
2393
+ assert(false);
2394
+ break;
2295
2395
  }
2296
- break;
2297
- }
2298
2396
 
2299
- case StateActive:
2300
- {
2301
- //
2302
- // Can only switch from holding or not validated to
2303
- // active.
2304
- //
2305
- if(_state != StateHolding && _state != StateNotValidated)
2397
+ case StateNotValidated:
2306
2398
  {
2307
- return;
2399
+ if(_state != StateNotInitialized)
2400
+ {
2401
+ assert(_state == StateClosed);
2402
+ return;
2403
+ }
2404
+ break;
2308
2405
  }
2309
- _threadPool->_register(this, SocketOperationRead);
2310
- break;
2311
- }
2312
2406
 
2313
- case StateHolding:
2314
- {
2315
- //
2316
- // Can only switch from active or not validated to
2317
- // holding.
2318
- //
2319
- if(_state != StateActive && _state != StateNotValidated)
2407
+ case StateActive:
2320
2408
  {
2321
- return;
2409
+ //
2410
+ // Can only switch from holding or not validated to
2411
+ // active.
2412
+ //
2413
+ if(_state != StateHolding && _state != StateNotValidated)
2414
+ {
2415
+ return;
2416
+ }
2417
+ _threadPool->_register(ICE_SHARED_FROM_THIS, SocketOperationRead);
2418
+ break;
2322
2419
  }
2323
- if(_state == StateActive)
2420
+
2421
+ case StateHolding:
2324
2422
  {
2325
- _threadPool->unregister(this, SocketOperationRead);
2423
+ //
2424
+ // Can only switch from active or not validated to
2425
+ // holding.
2426
+ //
2427
+ if(_state != StateActive && _state != StateNotValidated)
2428
+ {
2429
+ return;
2430
+ }
2431
+ if(_state == StateActive)
2432
+ {
2433
+ _threadPool->unregister(ICE_SHARED_FROM_THIS, SocketOperationRead);
2434
+ }
2435
+ break;
2326
2436
  }
2327
- break;
2328
- }
2329
2437
 
2330
- case StateClosing:
2331
- case StateClosingPending:
2332
- {
2333
- //
2334
- // Can't change back from closing pending.
2335
- //
2336
- if(_state >= StateClosingPending)
2438
+ case StateClosing:
2439
+ case StateClosingPending:
2337
2440
  {
2338
- return;
2441
+ //
2442
+ // Can't change back from closing pending.
2443
+ //
2444
+ if(_state >= StateClosingPending)
2445
+ {
2446
+ return;
2447
+ }
2448
+ break;
2339
2449
  }
2340
- break;
2341
- }
2342
2450
 
2343
- case StateClosed:
2344
- {
2345
- if(_state == StateFinished)
2451
+ case StateClosed:
2346
2452
  {
2347
- return;
2348
- }
2453
+ if(_state == StateFinished)
2454
+ {
2455
+ return;
2456
+ }
2349
2457
 
2350
- _batchRequestQueue->destroy(*_exception.get());
2458
+ _batchRequestQueue->destroy(*_exception);
2351
2459
 
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();
2460
+ //
2461
+ // Don't need to close now for connections so only close the transceiver
2462
+ // if the selector request it.
2463
+ //
2464
+ if(_threadPool->finish(ICE_SHARED_FROM_THIS, false))
2465
+ {
2466
+ _transceiver->close();
2467
+ }
2468
+ break;
2359
2469
  }
2360
- break;
2361
- }
2362
2470
 
2363
- case StateFinished:
2364
- {
2365
- assert(_state == StateClosed);
2366
- _communicator = 0;
2367
- break;
2368
- }
2471
+ case StateFinished:
2472
+ {
2473
+ assert(_state == StateClosed);
2474
+ _communicator = 0;
2475
+ break;
2476
+ }
2369
2477
  }
2370
2478
  }
2371
2479
  catch(const Ice::LocalException& ex)
@@ -2388,11 +2496,11 @@ Ice::ConnectionI::setState(State state)
2388
2496
  {
2389
2497
  _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
2390
2498
  }
2391
- _monitor->add(this);
2499
+ _monitor->add(ICE_SHARED_FROM_THIS);
2392
2500
  }
2393
2501
  else if(_state == StateActive)
2394
2502
  {
2395
- _monitor->remove(this);
2503
+ _monitor->remove(ICE_SHARED_FROM_THIS);
2396
2504
  }
2397
2505
  }
2398
2506
 
@@ -2407,16 +2515,16 @@ Ice::ConnectionI::setState(State state)
2407
2515
  newState,
2408
2516
  _observer.get()));
2409
2517
  }
2410
- if(_observer && state == StateClosed && _exception.get())
2518
+ if(_observer && state == StateClosed && _exception)
2411
2519
  {
2412
2520
  if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
2413
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
2521
+ dynamic_cast<const ConnectionManuallyClosedException*>(_exception.get()) ||
2414
2522
  dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
2415
2523
  dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
2416
2524
  dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
2417
2525
  (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state >= StateClosing)))
2418
2526
  {
2419
- _observer->failed(_exception->ice_name());
2527
+ _observer->failed(_exception->ice_id());
2420
2528
  }
2421
2529
  }
2422
2530
  }
@@ -2440,8 +2548,7 @@ Ice::ConnectionI::setState(State state)
2440
2548
  void
2441
2549
  Ice::ConnectionI::initiateShutdown()
2442
2550
  {
2443
- assert(_state == StateClosing);
2444
- assert(_dispatchCount == 0);
2551
+ assert(_state == StateClosing && _dispatchCount == 0);
2445
2552
 
2446
2553
  if(_shutdownInitiated)
2447
2554
  {
@@ -2454,7 +2561,7 @@ Ice::ConnectionI::initiateShutdown()
2454
2561
  //
2455
2562
  // Before we shut down, we send a close connection message.
2456
2563
  //
2457
- BasicStream os(_instance.get(), Ice::currentProtocolEncoding);
2564
+ OutputStream os(_instance.get(), Ice::currentProtocolEncoding);
2458
2565
  os.write(magic[0]);
2459
2566
  os.write(magic[1]);
2460
2567
  os.write(magic[2]);
@@ -2471,26 +2578,26 @@ Ice::ConnectionI::initiateShutdown()
2471
2578
  setState(StateClosingPending);
2472
2579
 
2473
2580
  //
2474
- // Notify the the transceiver of the graceful connection closure.
2581
+ // Notify the transceiver of the graceful connection closure.
2475
2582
  //
2476
- SocketOperation op = _transceiver->closing(true, *_exception.get());
2583
+ SocketOperation op = _transceiver->closing(true, *_exception);
2477
2584
  if(op)
2478
2585
  {
2479
2586
  scheduleTimeout(op);
2480
- _threadPool->_register(this, op);
2587
+ _threadPool->_register(ICE_SHARED_FROM_THIS, op);
2481
2588
  }
2482
2589
  }
2483
2590
  }
2484
2591
  }
2485
2592
 
2486
2593
  void
2487
- Ice::ConnectionI::heartbeat()
2594
+ Ice::ConnectionI::sendHeartbeatNow()
2488
2595
  {
2489
2596
  assert(_state == StateActive);
2490
2597
 
2491
2598
  if(!_endpoint->datagram())
2492
2599
  {
2493
- BasicStream os(_instance.get(), Ice::currentProtocolEncoding);
2600
+ OutputStream os(_instance.get(), Ice::currentProtocolEncoding);
2494
2601
  os.write(magic[0]);
2495
2602
  os.write(magic[1]);
2496
2603
  os.write(magic[2]);
@@ -2509,7 +2616,7 @@ Ice::ConnectionI::heartbeat()
2509
2616
  catch(const LocalException& ex)
2510
2617
  {
2511
2618
  setState(StateClosed, ex);
2512
- assert(_exception.get());
2619
+ assert(_exception);
2513
2620
  }
2514
2621
  }
2515
2622
  }
@@ -2517,11 +2624,11 @@ Ice::ConnectionI::heartbeat()
2517
2624
  bool
2518
2625
  Ice::ConnectionI::initialize(SocketOperation operation)
2519
2626
  {
2520
- SocketOperation s = _transceiver->initialize(_readStream, _writeStream, _hasMoreData);
2627
+ SocketOperation s = _transceiver->initialize(_readStream, _writeStream);
2521
2628
  if(s != SocketOperationNone)
2522
2629
  {
2523
2630
  scheduleTimeout(s);
2524
- _threadPool->update(this, operation, s);
2631
+ _threadPool->update(ICE_SHARED_FROM_THIS, operation, s);
2525
2632
  return false;
2526
2633
  }
2527
2634
 
@@ -2567,7 +2674,7 @@ Ice::ConnectionI::validate(SocketOperation operation)
2567
2674
  if(op)
2568
2675
  {
2569
2676
  scheduleTimeout(op);
2570
- _threadPool->update(this, operation, op);
2677
+ _threadPool->update(ICE_SHARED_FROM_THIS, operation, op);
2571
2678
  return false;
2572
2679
  }
2573
2680
  }
@@ -2596,7 +2703,7 @@ Ice::ConnectionI::validate(SocketOperation operation)
2596
2703
  if(op)
2597
2704
  {
2598
2705
  scheduleTimeout(op);
2599
- _threadPool->update(this, operation, op);
2706
+ _threadPool->update(ICE_SHARED_FROM_THIS, operation, op);
2600
2707
  return false;
2601
2708
  }
2602
2709
  }
@@ -2740,17 +2847,10 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks)
2740
2847
  //
2741
2848
  // Do compression.
2742
2849
  //
2743
- BasicStream stream(_instance.get(), Ice::currentProtocolEncoding);
2850
+ OutputStream stream(_instance.get(), Ice::currentProtocolEncoding);
2744
2851
  doCompress(*message->stream, stream);
2745
2852
 
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
- }
2853
+ traceSend(*message->stream, _logger, _traceLevels);
2754
2854
 
2755
2855
  message->adopt(&stream); // Adopt the compressed stream.
2756
2856
  message->stream->i = message->stream->b.begin();
@@ -2777,14 +2877,8 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks)
2777
2877
  copy(p, p + sizeof(Int), message->stream->b.begin() + 10);
2778
2878
  #endif
2779
2879
  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
- }
2880
+ traceSend(*message->stream, _logger, _traceLevels);
2881
+
2788
2882
  #ifdef ICE_HAS_BZIP2
2789
2883
  }
2790
2884
  #endif
@@ -2819,7 +2913,7 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks)
2819
2913
  if(_state == StateClosing && _shutdownInitiated)
2820
2914
  {
2821
2915
  setState(StateClosingPending);
2822
- SocketOperation op = _transceiver->closing(true, *_exception.get());
2916
+ SocketOperation op = _transceiver->closing(true, *_exception);
2823
2917
  if(op)
2824
2918
  {
2825
2919
  return op;
@@ -2865,18 +2959,11 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2865
2959
  //
2866
2960
  // Do compression.
2867
2961
  //
2868
- BasicStream stream(_instance.get(), Ice::currentProtocolEncoding);
2962
+ OutputStream stream(_instance.get(), Ice::currentProtocolEncoding);
2869
2963
  doCompress(*message.stream, stream);
2870
2964
  stream.i = stream.b.begin();
2871
2965
 
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
- }
2966
+ traceSend(*message.stream, _logger, _traceLevels);
2880
2967
 
2881
2968
  //
2882
2969
  // Send the message without blocking.
@@ -2931,14 +3018,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2931
3018
  #endif
2932
3019
  message.stream->i = message.stream->b.begin();
2933
3020
 
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
- }
3021
+ traceSend(*message.stream, _logger, _traceLevels);
2942
3022
 
2943
3023
  //
2944
3024
  // Send the message without blocking.
@@ -2974,7 +3054,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2974
3054
 
2975
3055
  _writeStream.swap(*_sendStreams.back().stream);
2976
3056
  scheduleTimeout(op);
2977
- _threadPool->_register(this, op);
3057
+ _threadPool->_register(ICE_SHARED_FROM_THIS, op);
2978
3058
  return AsyncStatusQueued;
2979
3059
  }
2980
3060
 
@@ -3041,7 +3121,7 @@ getBZ2Error(int bzError)
3041
3121
  }
3042
3122
 
3043
3123
  void
3044
- Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed)
3124
+ Ice::ConnectionI::doCompress(OutputStream& uncompressed, OutputStream& compressed)
3045
3125
  {
3046
3126
  const Byte* p;
3047
3127
 
@@ -3096,7 +3176,7 @@ Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed)
3096
3176
  }
3097
3177
 
3098
3178
  void
3099
- Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompressed)
3179
+ Ice::ConnectionI::doUncompress(InputStream& compressed, InputStream& uncompressed)
3100
3180
  {
3101
3181
  Int uncompressedSize;
3102
3182
  compressed.i = compressed.b.begin() + headerSize;
@@ -3131,9 +3211,9 @@ Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompresse
3131
3211
  #endif
3132
3212
 
3133
3213
  SocketOperation
3134
- Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& requestId, Byte& compress,
3214
+ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& requestId, Byte& compress,
3135
3215
  ServantManagerPtr& servantManager, ObjectAdapterPtr& adapter,
3136
- OutgoingAsyncBasePtr& outAsync, ConnectionCallbackPtr& heartbeatCallback,
3216
+ OutgoingAsyncBasePtr& outAsync, ICE_DELEGATE(HeartbeatCallback)& heartbeatCallback,
3137
3217
  int& dispatchCount)
3138
3218
  {
3139
3219
  assert(_state > StateNotValidated && _state < StateClosed);
@@ -3169,7 +3249,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3169
3249
  if(compress == 2)
3170
3250
  {
3171
3251
  #ifdef ICE_HAS_BZIP2
3172
- BasicStream ustream(_instance.get(), Ice::currentProtocolEncoding);
3252
+ InputStream ustream(_instance.get(), Ice::currentProtocolEncoding);
3173
3253
  doUncompress(stream, ustream);
3174
3254
  stream.b.swap(ustream.b);
3175
3255
  #else
@@ -3198,9 +3278,9 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3198
3278
  setState(StateClosingPending, CloseConnectionException(__FILE__, __LINE__));
3199
3279
 
3200
3280
  //
3201
- // Notify the the transceiver of the graceful connection closure.
3281
+ // Notify the transceiver of the graceful connection closure.
3202
3282
  //
3203
- SocketOperation op = _transceiver->closing(false, *_exception.get());
3283
+ SocketOperation op = _transceiver->closing(false, *_exception);
3204
3284
  if(op)
3205
3285
  {
3206
3286
  return op;
@@ -3258,54 +3338,22 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3258
3338
 
3259
3339
  stream.read(requestId);
3260
3340
 
3261
- map<Int, OutgoingBase*>::iterator p = _requests.end();
3262
3341
  map<Int, OutgoingAsyncBasePtr>::iterator q = _asyncRequests.end();
3263
3342
 
3264
- if(_requestsHint != _requests.end())
3265
- {
3266
- if(_requestsHint->first == requestId)
3267
- {
3268
- p = _requestsHint;
3269
- }
3270
- }
3271
-
3272
- if(p == _requests.end())
3343
+ if(_asyncRequestsHint != _asyncRequests.end())
3273
3344
  {
3274
- if(_asyncRequestsHint != _asyncRequests.end())
3345
+ if(_asyncRequestsHint->first == requestId)
3275
3346
  {
3276
- if(_asyncRequestsHint->first == requestId)
3277
- {
3278
- q = _asyncRequestsHint;
3279
- }
3347
+ q = _asyncRequestsHint;
3280
3348
  }
3281
3349
  }
3282
3350
 
3283
- if(p == _requests.end() && q == _asyncRequests.end())
3284
- {
3285
- p = _requests.find(requestId);
3286
- }
3287
-
3288
- if(p == _requests.end() && q == _asyncRequests.end())
3351
+ if(q == _asyncRequests.end())
3289
3352
  {
3290
3353
  q = _asyncRequests.find(requestId);
3291
3354
  }
3292
3355
 
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())
3356
+ if(q != _asyncRequests.end())
3309
3357
  {
3310
3358
  outAsync = q->second;
3311
3359
 
@@ -3321,7 +3369,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3321
3369
 
3322
3370
  stream.swap(*outAsync->getIs());
3323
3371
 
3324
- #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
3372
+ #if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP)
3325
3373
  //
3326
3374
  // If we just received the reply of a request which isn't acknowledge as
3327
3375
  // sent yet, we queue the reply instead of processing it right away. It
@@ -3333,7 +3381,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3333
3381
  message->receivedReply = true;
3334
3382
  outAsync = 0;
3335
3383
  }
3336
- else if(outAsync->completed())
3384
+ else if(outAsync->response())
3337
3385
  {
3338
3386
  ++dispatchCount;
3339
3387
  }
@@ -3342,7 +3390,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3342
3390
  outAsync = 0;
3343
3391
  }
3344
3392
  #else
3345
- if(outAsync->completed())
3393
+ if(outAsync->response())
3346
3394
  {
3347
3395
  ++dispatchCount;
3348
3396
  }
@@ -3360,9 +3408,9 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3360
3408
  case validateConnectionMsg:
3361
3409
  {
3362
3410
  traceRecv(stream, _logger, _traceLevels);
3363
- if(_callback)
3411
+ if(_heartbeatCallback)
3364
3412
  {
3365
- heartbeatCallback = _callback;
3413
+ heartbeatCallback = _heartbeatCallback;
3366
3414
  ++dispatchCount;
3367
3415
  }
3368
3416
  break;
@@ -3395,7 +3443,7 @@ Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& request
3395
3443
  }
3396
3444
 
3397
3445
  void
3398
- Ice::ConnectionI::invokeAll(BasicStream& stream, Int invokeNum, Int requestId, Byte compress,
3446
+ Ice::ConnectionI::invokeAll(InputStream& stream, Int invokeNum, Int requestId, Byte compress,
3399
3447
  const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter)
3400
3448
  {
3401
3449
  //
@@ -3530,11 +3578,17 @@ Ice::ConnectionI::initConnectionInfo() const
3530
3578
  }
3531
3579
  catch(const Ice::LocalException&)
3532
3580
  {
3533
- _info = new ConnectionInfo();
3581
+ _info = ICE_MAKE_SHARED(ConnectionInfo);
3582
+ }
3583
+
3584
+ Ice::ConnectionInfoPtr info = _info;
3585
+ while(info)
3586
+ {
3587
+ info->connectionId = _endpoint->connectionId();
3588
+ info->incoming = _connector == 0;
3589
+ info->adapterName = _adapter ? _adapter->getName() : string();
3590
+ info = info->underlying;
3534
3591
  }
3535
- _info->connectionId = _endpoint->connectionId();
3536
- _info->incoming = _connector == 0;
3537
- _info->adapterName = _adapter ? _adapter->getName() : string();
3538
3592
  return _info;
3539
3593
  }
3540
3594
 
@@ -3548,7 +3602,7 @@ SocketOperation
3548
3602
  ConnectionI::read(Buffer& buf)
3549
3603
  {
3550
3604
  Buffer::Container::iterator start = buf.i;
3551
- SocketOperation op = _transceiver->read(buf, _hasMoreData);
3605
+ SocketOperation op = _transceiver->read(buf);
3552
3606
  if(_instance->traceLevels()->network >= 3 && buf.i != start)
3553
3607
  {
3554
3608
  Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
@@ -3589,7 +3643,7 @@ ConnectionI::reap()
3589
3643
  {
3590
3644
  if(_monitor)
3591
3645
  {
3592
- _monitor->reap(this);
3646
+ _monitor->reap(ICE_SHARED_FROM_THIS);
3593
3647
  }
3594
3648
  if(_observer)
3595
3649
  {