zeroc-ice 3.8.2 → 3.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/dist/IceRuby/Communicator.cpp +26 -9
  3. data/dist/IceRuby/Config.h +0 -12
  4. data/dist/IceRuby/Connection.cpp +18 -9
  5. data/dist/IceRuby/DefaultSliceLoader.h +1 -1
  6. data/dist/IceRuby/Endpoint.cpp +21 -8
  7. data/dist/IceRuby/Operation.cpp +7 -5
  8. data/dist/IceRuby/Properties.cpp +3 -4
  9. data/dist/IceRuby/Proxy.cpp +11 -19
  10. data/dist/IceRuby/RubySliceLoader.cpp +1 -1
  11. data/dist/IceRuby/RubySliceLoader.h +6 -0
  12. data/dist/IceRuby/Types.cpp +162 -138
  13. data/dist/IceRuby/Types.h +68 -28
  14. data/dist/IceRuby/Util.cpp +14 -78
  15. data/dist/IceRuby/Util.h +7 -17
  16. data/dist/ice/cpp/include/Ice/Communicator.h +31 -8
  17. data/dist/ice/cpp/include/Ice/Config.h +2 -2
  18. data/dist/ice/cpp/include/Ice/Connection.h +24 -8
  19. data/dist/ice/cpp/include/Ice/CtrlCHandler.h +1 -1
  20. data/dist/ice/cpp/include/Ice/Demangle.h +1 -1
  21. data/dist/ice/cpp/include/Ice/Endpoint.h +4 -4
  22. data/dist/ice/cpp/include/Ice/Initialize.h +4 -4
  23. data/dist/ice/cpp/include/Ice/InputStream.h +5 -5
  24. data/dist/ice/cpp/include/Ice/Instrumentation.h +13 -7
  25. data/dist/ice/cpp/include/Ice/LocalExceptions.h +5 -5
  26. data/dist/ice/cpp/include/Ice/Logger.h +7 -0
  27. data/dist/ice/cpp/include/Ice/LoggerUtil.h +1 -1
  28. data/dist/ice/cpp/include/Ice/Object.h +10 -8
  29. data/dist/ice/cpp/include/Ice/ObjectAdapter.h +1 -1
  30. data/dist/ice/cpp/include/Ice/OutgoingAsync.h +5 -2
  31. data/dist/ice/cpp/include/Ice/OutgoingResponse.h +2 -1
  32. data/dist/ice/cpp/include/Ice/OutputStream.h +7 -6
  33. data/dist/ice/cpp/include/Ice/PluginFactory.h +1 -1
  34. data/dist/ice/cpp/include/Ice/Properties.h +3 -3
  35. data/dist/ice/cpp/include/Ice/Proxy.h +192 -50
  36. data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +3 -3
  37. data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +1 -1
  38. data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +5 -5
  39. data/dist/ice/cpp/include/Ice/ServantLocator.h +1 -1
  40. data/dist/ice/cpp/include/Ice/Service.h +2 -5
  41. data/dist/ice/cpp/include/Ice/SliceLoader.h +1 -1
  42. data/dist/ice/cpp/include/Ice/SlicedData.h +5 -3
  43. data/dist/ice/cpp/include/Ice/StreamHelpers.h +1 -1
  44. data/dist/ice/cpp/include/Ice/StreamableTraits.h +2 -2
  45. data/dist/ice/cpp/include/Ice/StringConverter.h +2 -3
  46. data/dist/ice/cpp/include/Ice/StringUtil.h +2 -7
  47. data/dist/ice/cpp/include/Ice/UUID.h +1 -0
  48. data/dist/ice/cpp/include/Ice/Value.h +2 -2
  49. data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
  50. data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
  51. data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
  52. data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
  53. data/dist/ice/cpp/include/generated/Ice/Locator.h +50 -14
  54. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
  55. data/dist/ice/cpp/include/generated/Ice/Metrics.h +94 -39
  56. data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
  57. data/dist/ice/cpp/include/generated/Ice/Process.h +34 -8
  58. data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +42 -11
  59. data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
  60. data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +93 -40
  61. data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +2 -2
  62. data/dist/ice/cpp/include/generated/Ice/Router.h +50 -14
  63. data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
  64. data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
  65. data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +66 -14
  66. data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +34 -8
  67. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +1 -1
  68. data/dist/ice/cpp/src/Ice/Base64.cpp +47 -137
  69. data/dist/ice/cpp/src/Ice/Base64.h +2 -2
  70. data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +28 -13
  71. data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +5 -1
  72. data/dist/ice/cpp/src/Ice/Buffer.cpp +1 -1
  73. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +1 -1
  74. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +1 -1
  75. data/dist/ice/cpp/src/Ice/Communicator.cpp +4 -3
  76. data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +8 -0
  77. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +5 -15
  78. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +1 -1
  79. data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +6 -8
  80. data/dist/ice/cpp/src/Ice/ConnectionFactory.h +0 -3
  81. data/dist/ice/cpp/src/Ice/ConnectionI.cpp +94 -99
  82. data/dist/ice/cpp/src/Ice/ConnectionI.h +11 -8
  83. data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +1 -1
  84. data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -14
  85. data/dist/ice/cpp/src/Ice/EndpointI.h +1 -1
  86. data/dist/ice/cpp/src/Ice/FileUtil.cpp +12 -12
  87. data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
  88. data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
  89. data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
  90. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
  91. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +1 -3
  92. data/dist/ice/cpp/src/Ice/InputStream.cpp +23 -19
  93. data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
  94. data/dist/ice/cpp/src/Ice/Instance.h +1 -6
  95. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +1 -1
  96. data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
  97. data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
  98. data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
  99. data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
  100. data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
  101. data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
  102. data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
  103. data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
  104. data/dist/ice/cpp/src/Ice/Network.h +12 -7
  105. data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
  106. data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
  107. data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
  108. data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
  109. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
  110. data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
  111. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +1 -1
  112. data/dist/ice/cpp/src/Ice/OutputStream.cpp +4 -4
  113. data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
  114. data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
  115. data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
  116. data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
  117. data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
  118. data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
  119. data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
  120. data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
  121. data/dist/ice/cpp/src/Ice/Random.h +6 -2
  122. data/dist/ice/cpp/src/Ice/Reference.cpp +22 -11
  123. data/dist/ice/cpp/src/Ice/Reference.h +3 -0
  124. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +10 -0
  125. data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
  126. data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
  127. data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
  128. data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
  129. data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
  130. data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
  131. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
  132. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
  133. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +15 -1
  134. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
  135. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
  136. data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
  137. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
  138. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +130 -52
  139. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +64 -33
  140. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
  141. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +3 -3
  142. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
  143. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
  144. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
  145. data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
  146. data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
  147. data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
  148. data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
  149. data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
  150. data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
  151. data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
  152. data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
  153. data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
  154. data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
  155. data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
  156. data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
  157. data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
  158. data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
  159. data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
  160. data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
  161. data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
  162. data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
  163. data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
  164. data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
  165. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +4 -1
  166. data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
  167. data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
  168. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +96 -27
  169. data/dist/ice/cpp/src/Ice/WSTransceiver.h +1 -1
  170. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
  171. data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
  172. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
  173. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
  174. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
  175. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
  176. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
  177. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
  178. data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
  179. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
  180. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
  181. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
  182. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +2 -2
  183. data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
  184. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
  185. data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
  186. data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
  187. data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
  188. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
  189. data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
  190. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
  191. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +26 -20
  192. data/dist/ice/cpp/src/Slice/DocCommentParser.h +2 -2
  193. data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
  194. data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
  195. data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
  196. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +10 -9
  197. data/dist/ice/cpp/src/Slice/Parser.cpp +28 -20
  198. data/dist/ice/cpp/src/Slice/Parser.h +3 -4
  199. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +3 -11
  200. data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -2
  201. data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
  202. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +197 -114
  203. data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
  204. data/dist/ice/cpp/src/Slice/Util.h +21 -9
  205. data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
  206. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +16 -12
  207. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +3 -3
  208. data/dist/ice/slice/Glacier2/Router.ice +3 -3
  209. data/dist/ice/slice/Ice/Metrics.ice +6 -5
  210. data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
  211. data/dist/ice/slice/IceGrid/Admin.ice +9 -9
  212. data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
  213. data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
  214. data/dist/lib/Glacier2/Metrics.rb +1 -1
  215. data/dist/lib/Glacier2/PermissionsVerifier.rb +1 -1
  216. data/dist/lib/Glacier2/Router.rb +2 -2
  217. data/dist/lib/Glacier2/SSLInfo.rb +1 -1
  218. data/dist/lib/Glacier2/Session.rb +1 -1
  219. data/dist/lib/Ice/BuiltinSequences.rb +1 -1
  220. data/dist/lib/Ice/CompressBatch.rb +1 -2
  221. data/dist/lib/Ice/Context.rb +1 -1
  222. data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
  223. data/dist/lib/Ice/EndpointTypes.rb +1 -1
  224. data/dist/lib/Ice/Identity.rb +1 -1
  225. data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
  226. data/dist/lib/Ice/Locator.rb +1 -1
  227. data/dist/lib/Ice/LocatorRegistry.rb +1 -1
  228. data/dist/lib/Ice/Metrics.rb +1 -1
  229. data/dist/lib/Ice/OperationMode.rb +2 -3
  230. data/dist/lib/Ice/Process.rb +1 -1
  231. data/dist/lib/Ice/PropertiesAdmin.rb +1 -1
  232. data/dist/lib/Ice/PropertyDict.rb +1 -1
  233. data/dist/lib/Ice/RemoteLogger.rb +2 -3
  234. data/dist/lib/Ice/ReplyStatus.rb +2 -3
  235. data/dist/lib/Ice/Router.rb +1 -1
  236. data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
  237. data/dist/lib/Ice/SliceUtil.rb +2 -2
  238. data/dist/lib/Ice/Struct.rb +1 -0
  239. data/dist/lib/Ice/ToStringMode.rb +1 -2
  240. data/dist/lib/Ice/Value.rb +2 -2
  241. data/dist/lib/Ice/Version.rb +1 -1
  242. data/dist/lib/IceBox/ServiceManager.rb +1 -1
  243. data/dist/lib/IceGrid/Admin.rb +3 -4
  244. data/dist/lib/IceGrid/Descriptor.rb +1 -1
  245. data/dist/lib/IceGrid/Exception.rb +1 -1
  246. data/dist/lib/IceGrid/FileParser.rb +1 -1
  247. data/dist/lib/IceGrid/Registry.rb +2 -3
  248. data/dist/lib/IceGrid/Session.rb +2 -2
  249. data/dist/lib/IceGrid/UserAccountMapper.rb +1 -1
  250. data/dist/lib/IceStorm/IceStorm.rb +1 -1
  251. data/dist/lib/IceStorm/Metrics.rb +1 -1
  252. data/extconf.rb +1 -1
  253. data/ice.gemspec +3 -3
  254. metadata +4 -5
  255. data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
  256. data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
@@ -3,7 +3,6 @@
3
3
  #include "Network.h"
4
4
  #include "Ice/LocalExceptions.h"
5
5
  #include "Ice/LoggerUtil.h" // For setTcpBufSize
6
- #include "Ice/Properties.h" // For setTcpBufSize
7
6
  #include "Ice/StringUtil.h"
8
7
  #include "NetworkProxy.h"
9
8
  #include "ProtocolInstance.h" // For setTcpBufSize
@@ -242,7 +241,7 @@ namespace
242
241
  if (pos != string::npos)
243
242
  {
244
243
  //
245
- // If it's a link-local address, use the zone indice.
244
+ // If it's a link-local address, use the zone index.
246
245
  //
247
246
  isAddr = false;
248
247
  name = intf.substr(pos + 1);
@@ -387,7 +386,7 @@ namespace
387
386
  while (paddrs)
388
387
  {
389
388
  //
390
- // Don't need to pass a wide string converter as the wide string come
389
+ // Don't need to pass a wide string converter as the wide string comes
391
390
  // from Windows API.
392
391
  //
393
392
  if (wstringToString(paddrs->FriendlyName, getProcessStringConverter()) == name)
@@ -580,7 +579,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
580
579
  } while (info == nullptr && rs == EAI_AGAIN && --retry >= 0);
581
580
 
582
581
  // In theory, getaddrinfo should only return EAI_NONAME if
583
- // AI_NUMERICHOST is specified and the host name is not a IP
582
+ // AI_NUMERICHOST is specified and the host name is not an IP
584
583
  // address. However on some platforms (e.g. macOS 10.4.x)
585
584
  // EAI_NODATA is also returned so we also check for it.
586
585
  #ifdef EAI_NODATA
@@ -720,6 +719,16 @@ IceInternal::compareAddress(const Address& addr1, const Address& addr2)
720
719
  {
721
720
  return 1;
722
721
  }
722
+
723
+ // Distinguish scoped link-local addresses such as fe80::1%eth0 and fe80::1%eth1.
724
+ if (addr1.saIn6.sin6_scope_id < addr2.saIn6.sin6_scope_id)
725
+ {
726
+ return -1;
727
+ }
728
+ else if (addr2.saIn6.sin6_scope_id < addr1.saIn6.sin6_scope_id)
729
+ {
730
+ return 1;
731
+ }
723
732
  }
724
733
 
725
734
  return 0;
@@ -814,7 +823,15 @@ IceInternal::addrToString(const Address& addr)
814
823
  if (isAddressValid(addr))
815
824
  {
816
825
  ostringstream s;
817
- s << inetAddrToString(addr) << ':' << getPort(addr);
826
+ // An IPv6 address is enclosed in square brackets in the host:port form, e.g. [::1]:4061.
827
+ if (addr.saStorage.ss_family == AF_INET6)
828
+ {
829
+ s << '[' << inetAddrToString(addr) << "]:" << getPort(addr);
830
+ }
831
+ else
832
+ {
833
+ s << inetAddrToString(addr) << ':' << getPort(addr);
834
+ }
818
835
  return s.str();
819
836
  }
820
837
  else
@@ -852,70 +869,86 @@ IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr)
852
869
  }
853
870
 
854
871
  std::string
855
- IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address& target)
872
+ IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address& target) noexcept
856
873
  {
857
874
  if (fd == INVALID_SOCKET)
858
875
  {
859
876
  return "<closed>";
860
877
  }
861
878
 
862
- ostringstream s;
879
+ try
880
+ {
881
+ ostringstream s;
863
882
 
864
- Address remoteAddr;
865
- bool peerConnected = fdToRemoteAddress(fd, remoteAddr);
883
+ Address remoteAddr;
884
+ bool peerConnected = fdToRemoteAddress(fd, remoteAddr);
866
885
 
867
886
  #ifdef _WIN32
868
- if (!peerConnected)
869
- {
870
- //
871
- // The local address is only accessible with connected sockets on Windows.
872
- //
873
- s << "local address = <not available>";
874
- }
875
- else
887
+ if (!peerConnected)
888
+ {
889
+ //
890
+ // The local address is only accessible with connected sockets on Windows.
891
+ //
892
+ s << "local address = <not available>";
893
+ }
894
+ else
876
895
  #endif
877
- {
878
- Address localAddr;
879
- fdToLocalAddress(fd, localAddr);
880
- s << "local address = " << addrToString(localAddr);
881
- }
896
+ {
897
+ Address localAddr;
898
+ fdToLocalAddress(fd, localAddr);
899
+ s << "local address = " << addrToString(localAddr);
900
+ }
882
901
 
883
- if (proxy)
884
- {
885
- if (!peerConnected)
902
+ if (proxy)
886
903
  {
887
- remoteAddr = proxy->getAddress();
904
+ if (!peerConnected)
905
+ {
906
+ remoteAddr = proxy->getAddress();
907
+ }
908
+ s << "\n" + proxy->getName() + " proxy address = " << addrToString(remoteAddr);
909
+ s << "\nremote address = " << addrToString(target);
888
910
  }
889
- s << "\n" + proxy->getName() + " proxy address = " << addrToString(remoteAddr);
890
- s << "\nremote address = " << addrToString(target);
891
- }
892
- else
893
- {
894
- if (!peerConnected)
911
+ else
895
912
  {
896
- remoteAddr = target;
913
+ if (!peerConnected)
914
+ {
915
+ remoteAddr = target;
916
+ }
917
+ s << "\nremote address = " << addrToString(remoteAddr);
897
918
  }
898
- s << "\nremote address = " << addrToString(remoteAddr);
899
- }
900
919
 
901
- return s.str();
920
+ return s.str();
921
+ }
922
+ catch (...)
923
+ {
924
+ // The description is best-effort: the address queries can fail only in extreme conditions such as kernel
925
+ // resource exhaustion.
926
+ return "<not available>";
927
+ }
902
928
  }
903
929
 
904
930
  std::string
905
- IceInternal::fdToString(SOCKET fd)
931
+ IceInternal::fdToString(SOCKET fd) noexcept
906
932
  {
907
933
  if (fd == INVALID_SOCKET)
908
934
  {
909
935
  return "<closed>";
910
936
  }
911
937
 
912
- Address localAddr;
913
- fdToLocalAddress(fd, localAddr);
938
+ try
939
+ {
940
+ Address localAddr;
941
+ fdToLocalAddress(fd, localAddr);
914
942
 
915
- Address remoteAddr;
916
- bool peerConnected = fdToRemoteAddress(fd, remoteAddr);
943
+ Address remoteAddr;
944
+ bool peerConnected = fdToRemoteAddress(fd, remoteAddr);
917
945
 
918
- return addressesToString(localAddr, remoteAddr, peerConnected);
946
+ return addressesToString(localAddr, remoteAddr, peerConnected);
947
+ }
948
+ catch (...)
949
+ {
950
+ return "<not available>";
951
+ }
919
952
  }
920
953
 
921
954
  void
@@ -1068,26 +1101,6 @@ IceInternal::isMulticast(const Address& addr)
1068
1101
  return false;
1069
1102
  }
1070
1103
 
1071
- void
1072
- IceInternal::setTcpBufSize(SOCKET fd, const ProtocolInstancePtr& instance)
1073
- {
1074
- assert(fd != INVALID_SOCKET);
1075
-
1076
- //
1077
- // By default, on Windows we use a 128KB buffer size. On Unix
1078
- // platforms, we use the system defaults.
1079
- //
1080
- #ifdef _WIN32
1081
- const int dfltBufSize = 128 * 1024;
1082
- #else
1083
- const int dfltBufSize = 0;
1084
- #endif
1085
- int32_t rcvSize = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
1086
- int32_t sndSize = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);
1087
-
1088
- setTcpBufSize(fd, rcvSize, sndSize, instance);
1089
- }
1090
-
1091
1104
  void
1092
1105
  IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolInstancePtr& instance)
1093
1106
  {
@@ -1102,7 +1115,7 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn
1102
1115
  //
1103
1116
  setRecvBufferSize(fd, rcvSize);
1104
1117
  int size = getRecvBufferSize(fd);
1105
- if (size > 0 && size < rcvSize)
1118
+ if (size < rcvSize)
1106
1119
  {
1107
1120
  // Warn if the size that was set is less than the requested size and
1108
1121
  // we have not already warned.
@@ -1125,7 +1138,7 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn
1125
1138
  //
1126
1139
  setSendBufferSize(fd, sndSize);
1127
1140
  int size = getSendBufferSize(fd);
1128
- if (size > 0 && size < sndSize)
1141
+ if (size < sndSize)
1129
1142
  {
1130
1143
  // Warn if the size that was set is less than the requested size and
1131
1144
  // we have not already warned.
@@ -1199,10 +1212,8 @@ IceInternal::setSendBufferSize(SOCKET fd, int sz)
1199
1212
  int
1200
1213
  IceInternal::getSendBufferSize(SOCKET fd)
1201
1214
  {
1202
- int sz;
1203
- socklen_t len = sizeof(sz);
1204
- if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
1205
- static_cast<unsigned int>(len) != sizeof(sz))
1215
+ int sz = getSendBufferSizeNoThrow(fd);
1216
+ if (sz == 0)
1206
1217
  {
1207
1218
  closeSocketNoThrow(fd);
1208
1219
  throw SocketException(__FILE__, __LINE__, getSocketErrno());
@@ -1222,14 +1233,38 @@ IceInternal::setRecvBufferSize(SOCKET fd, int sz)
1222
1233
 
1223
1234
  int
1224
1235
  IceInternal::getRecvBufferSize(SOCKET fd)
1236
+ {
1237
+ int sz = getRecvBufferSizeNoThrow(fd);
1238
+ if (sz == 0)
1239
+ {
1240
+ closeSocketNoThrow(fd);
1241
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
1242
+ }
1243
+ return sz;
1244
+ }
1245
+
1246
+ int
1247
+ IceInternal::getSendBufferSizeNoThrow(SOCKET fd) noexcept
1248
+ {
1249
+ int sz;
1250
+ socklen_t len = sizeof(sz);
1251
+ if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
1252
+ static_cast<unsigned int>(len) != sizeof(sz))
1253
+ {
1254
+ return 0;
1255
+ }
1256
+ return sz;
1257
+ }
1258
+
1259
+ int
1260
+ IceInternal::getRecvBufferSizeNoThrow(SOCKET fd) noexcept
1225
1261
  {
1226
1262
  int sz;
1227
1263
  socklen_t len = sizeof(sz);
1228
1264
  if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
1229
1265
  static_cast<unsigned int>(len) != sizeof(sz))
1230
1266
  {
1231
- closeSocketNoThrow(fd);
1232
- throw SocketException(__FILE__, __LINE__, getSocketErrno());
1267
+ return 0;
1233
1268
  }
1234
1269
  return sz;
1235
1270
  }
@@ -1237,51 +1272,80 @@ IceInternal::getRecvBufferSize(SOCKET fd)
1237
1272
  void
1238
1273
  IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string& intf)
1239
1274
  {
1240
- vector<string> interfaces = getInterfacesForMulticast(intf, getProtocolSupport(group));
1241
- set<int> indexes;
1242
- for (const auto& interface : interfaces)
1275
+ try
1243
1276
  {
1244
- int rc = 0;
1245
- if (group.saStorage.ss_family == AF_INET)
1277
+ vector<string> interfaces = getInterfacesForMulticast(intf, getProtocolSupport(group));
1278
+ set<int> indexes;
1279
+ for (const auto& interface : interfaces)
1246
1280
  {
1247
- struct ip_mreq mreq;
1248
- mreq.imr_multiaddr = group.saIn.sin_addr;
1249
- mreq.imr_interface = getInterfaceAddress(interface);
1250
- rc = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<char*>(&mreq), int(sizeof(mreq)));
1251
- }
1252
- else
1253
- {
1254
- int index = getInterfaceIndex(interface);
1255
- if (indexes.find(index) == indexes.end()) // Don't join twice the same interface (if it has multiple IPs)
1281
+ int rc = 0;
1282
+ if (group.saStorage.ss_family == AF_INET)
1256
1283
  {
1257
- indexes.insert(index);
1258
- struct ipv6_mreq mreq;
1259
- mreq.ipv6mr_multiaddr = group.saIn6.sin6_addr;
1260
- mreq.ipv6mr_interface = static_cast<unsigned int>(index);
1261
- rc = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, reinterpret_cast<char*>(&mreq), int(sizeof(mreq)));
1284
+ struct ip_mreq mreq;
1285
+ mreq.imr_multiaddr = group.saIn.sin_addr;
1286
+ mreq.imr_interface = getInterfaceAddress(interface);
1287
+ rc = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<char*>(&mreq), int(sizeof(mreq)));
1288
+ }
1289
+ else
1290
+ {
1291
+ int index = getInterfaceIndex(interface);
1292
+ // Don't join twice the same interface (if it has multiple IPs).
1293
+ if (indexes.find(index) == indexes.end())
1294
+ {
1295
+ indexes.insert(index);
1296
+ struct ipv6_mreq mreq;
1297
+ mreq.ipv6mr_multiaddr = group.saIn6.sin6_addr;
1298
+ mreq.ipv6mr_interface = static_cast<unsigned int>(index);
1299
+ rc = setsockopt(
1300
+ fd,
1301
+ IPPROTO_IPV6,
1302
+ IPV6_JOIN_GROUP,
1303
+ reinterpret_cast<char*>(&mreq),
1304
+ int(sizeof(mreq)));
1305
+ }
1306
+ }
1307
+ if (rc == SOCKET_ERROR)
1308
+ {
1309
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
1262
1310
  }
1263
- }
1264
- if (rc == SOCKET_ERROR)
1265
- {
1266
- closeSocketNoThrow(fd);
1267
- throw SocketException(__FILE__, __LINE__, getSocketErrno());
1268
1311
  }
1269
1312
  }
1313
+ catch (...)
1314
+ {
1315
+ // Close the socket on any failure (interface resolution or the multicast join) so this helper always
1316
+ // leaves the socket closed when it throws, like doBind and setReuseAddress.
1317
+ closeSocketNoThrow(fd);
1318
+ throw;
1319
+ }
1270
1320
  }
1271
1321
 
1272
1322
  void
1273
1323
  IceInternal::setMcastInterface(SOCKET fd, const string& intf, const Address& addr)
1274
1324
  {
1275
1325
  int rc;
1276
- if (addr.saStorage.ss_family == AF_INET)
1326
+ try
1277
1327
  {
1278
- struct in_addr iface = getInterfaceAddress(intf);
1279
- rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast<char*>(&iface), int(sizeof(iface)));
1328
+ if (addr.saStorage.ss_family == AF_INET)
1329
+ {
1330
+ struct in_addr iface = getInterfaceAddress(intf);
1331
+ rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast<char*>(&iface), int(sizeof(iface)));
1332
+ }
1333
+ else
1334
+ {
1335
+ int interfaceNum = getInterfaceIndex(intf);
1336
+ rc = setsockopt(
1337
+ fd,
1338
+ IPPROTO_IPV6,
1339
+ IPV6_MULTICAST_IF,
1340
+ reinterpret_cast<char*>(&interfaceNum),
1341
+ int(sizeof(int)));
1342
+ }
1280
1343
  }
1281
- else
1344
+ catch (const Ice::SocketException&)
1282
1345
  {
1283
- int interfaceNum = getInterfaceIndex(intf);
1284
- rc = setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, reinterpret_cast<char*>(&interfaceNum), int(sizeof(int)));
1346
+ // getInterfaceAddress and getInterfaceIndex throw if the interface cannot be resolved.
1347
+ closeSocketNoThrow(fd);
1348
+ throw;
1285
1349
  }
1286
1350
  if (rc == SOCKET_ERROR)
1287
1351
  {
@@ -1779,7 +1843,7 @@ void
1779
1843
  IceInternal::doConnectAsync(SOCKET fd, const Address& addr, const Address& sourceAddr, AsyncInfo& info)
1780
1844
  {
1781
1845
  //
1782
- // NOTE: It's the caller's responsability to close the socket upon
1846
+ // NOTE: It's the caller's responsibility to close the socket upon
1783
1847
  // failure to connect. The socket isn't closed by this method.
1784
1848
  //
1785
1849
  Address bindAddr;
@@ -1903,8 +1967,9 @@ IceInternal::isLoopbackOrMulticastAddress(const string& name)
1903
1967
  in6_addr addr6;
1904
1968
  if (inet_pton(AF_INET, name.c_str(), &addr) > 0)
1905
1969
  {
1906
- // It's an IPv4 address
1907
- return addr.s_addr == htonl(INADDR_LOOPBACK) || IN_MULTICAST(ntohl(addr.s_addr));
1970
+ // It's an IPv4 address. The whole 127.0.0.0/8 range is loopback, not just 127.0.0.1.
1971
+ const uint32_t host = ntohl(addr.s_addr);
1972
+ return (host & 0xFF000000u) == 0x7F000000u || IN_MULTICAST(host);
1908
1973
  }
1909
1974
  else if (inet_pton(AF_INET6, name.c_str(), &addr6) > 0)
1910
1975
  {
@@ -5,9 +5,7 @@
5
5
 
6
6
  #include "Ice/Config.h"
7
7
  #include "Ice/EndpointTypes.h"
8
- #include "Ice/Logger.h" // For setTcpBufSize
9
- #include "Ice/PropertiesF.h" // For setTcpBufSize
10
- #include "Ice/StringUtil.h" // For ErrorCode
8
+ #include "Ice/StringUtil.h" // For ErrorCode
11
9
  #include "NetworkF.h"
12
10
  #include "NetworkProxyF.h"
13
11
  #include "Protocol.h"
@@ -45,7 +43,7 @@ typedef int ssize_t;
45
43
  # error "Unsupported platform"
46
44
  #endif
47
45
 
48
- #if defined(_WIN32) || defined(__osf__)
46
+ #if defined(_WIN32)
49
47
  typedef int socklen_t;
50
48
  #endif
51
49
 
@@ -147,6 +145,10 @@ namespace IceInternal
147
145
 
148
146
  [[nodiscard]] SOCKET fd() const { return _fd; }
149
147
 
148
+ // Forgets the fd. Called when a failed socket operation has already closed the fd, so that close() does not
149
+ // close an unrelated descriptor later assigned the same number.
150
+ void clearFd() noexcept { _fd = INVALID_SOCKET; }
151
+
150
152
  void setReadyCallback(const ReadyCallbackPtr& callback);
151
153
 
152
154
  void ready(SocketOperation operation, bool value)
@@ -198,8 +200,8 @@ namespace IceInternal
198
200
  ICE_API std::string addrToString(const Address&);
199
201
  ICE_API void fdToLocalAddress(SOCKET, Address&);
200
202
  ICE_API bool fdToRemoteAddress(SOCKET, Address&);
201
- ICE_API std::string fdToString(SOCKET, const NetworkProxyPtr&, const Address&);
202
- ICE_API std::string fdToString(SOCKET);
203
+ ICE_API std::string fdToString(SOCKET, const NetworkProxyPtr&, const Address&) noexcept;
204
+ ICE_API std::string fdToString(SOCKET) noexcept;
203
205
  ICE_API void fdToAddressAndPort(SOCKET, std::string&, int&, std::string&, int&);
204
206
  ICE_API void addrToAddressAndPort(const Address&, std::string&, int&);
205
207
  ICE_API std::string addressesToString(const Address&, const Address&, bool);
@@ -212,7 +214,6 @@ namespace IceInternal
212
214
  ICE_API void setPort(Address&, int);
213
215
 
214
216
  ICE_API bool isMulticast(const Address&);
215
- ICE_API void setTcpBufSize(SOCKET, const ProtocolInstancePtr&);
216
217
  ICE_API void setTcpBufSize(SOCKET, int, int, const ProtocolInstancePtr&);
217
218
 
218
219
  ICE_API void setBlock(SOCKET, bool);
@@ -221,6 +222,10 @@ namespace IceInternal
221
222
  ICE_API void setRecvBufferSize(SOCKET, int);
222
223
  ICE_API int getRecvBufferSize(SOCKET);
223
224
 
225
+ // Non-throwing variants that return 0 on failure and never close the fd.
226
+ ICE_API int getSendBufferSizeNoThrow(SOCKET) noexcept;
227
+ ICE_API int getRecvBufferSizeNoThrow(SOCKET) noexcept;
228
+
224
229
  ICE_API void setMcastGroup(SOCKET, const Address&, const std::string&);
225
230
  ICE_API void setMcastInterface(SOCKET, const std::string&, const Address&);
226
231
  ICE_API void setMcastTtl(SOCKET, int, const Address&);
@@ -142,7 +142,7 @@ SOCKSNetworkProxy::finish(Buffer& readBuffer, Buffer&)
142
142
  throw Ice::ConnectFailedException{
143
143
  __FILE__,
144
144
  __LINE__,
145
- "connection establishment failed due to an HTTP proxy error"};
145
+ "connection establishment failed due to a SOCKS4 proxy error"};
146
146
  }
147
147
  }
148
148
 
@@ -224,27 +224,38 @@ HTTPNetworkProxy::endRead(Buffer& buf)
224
224
  // reading otherwise we're done.
225
225
  //
226
226
  const byte* end = HttpParser().isCompleteMessage(buf.b.begin(), buf.i);
227
- if (!end && buf.i == buf.b.end())
227
+ if (end)
228
+ {
229
+ return SocketOperationNone;
230
+ }
231
+
232
+ if (buf.i == buf.b.end())
228
233
  {
229
234
  //
230
235
  // Read one more byte, we can't easily read bytes in advance
231
- // since the transport implementation might be be able to read
236
+ // since the transport implementation might be able to read
232
237
  // the data from the memory instead of the socket. This is for
233
238
  // instance the case with the OpenSSL transport (or we would
234
239
  // have to use a buffering BIO).
235
240
  //
236
241
  buf.b.resize(buf.b.size() + 1);
237
242
  buf.i = buf.b.begin() + buf.b.size() - 1;
238
- return SocketOperationRead;
239
243
  }
240
- return SocketOperationNone;
244
+ return SocketOperationRead;
241
245
  }
242
246
 
243
247
  void
244
248
  HTTPNetworkProxy::finish(Buffer& readBuffer, Buffer&)
245
249
  {
246
250
  HttpParser parser;
247
- parser.parse(readBuffer.b.begin(), readBuffer.b.end());
251
+ try
252
+ {
253
+ parser.parse(readBuffer.b.begin(), readBuffer.b.end());
254
+ }
255
+ catch (const WebSocketException& ex)
256
+ {
257
+ throw Ice::ProtocolException{__FILE__, __LINE__, "malformed HTTP proxy response: " + ex.reason};
258
+ }
248
259
  if (parser.status() != 200)
249
260
  {
250
261
  throw Ice::ConnectFailedException{
@@ -4,6 +4,7 @@
4
4
  #define ICE_NETWORK_PROXY_H
5
5
 
6
6
  #include "Ice/Buffer.h"
7
+ #include "Ice/PropertiesF.h"
7
8
  #include "Network.h"
8
9
 
9
10
  namespace IceInternal
@@ -39,7 +40,7 @@ namespace IceInternal
39
40
  // If the proxy host needs to be resolved, this should return
40
41
  // a new NetworkProxy containing the IP address of the proxy.
41
42
  // This is called from the endpoint host resolver thread, so
42
- // it's safe if this this method blocks.
43
+ // it's safe if this method blocks.
43
44
  //
44
45
  [[nodiscard]] virtual NetworkProxyPtr resolveHost(ProtocolSupport) const = 0;
45
46
 
@@ -91,7 +91,7 @@ Ice::Object::_iceD_ice_ids(
91
91
  }
92
92
  else
93
93
  {
94
- ostr->write(&ret[0], &ret[0] + ret.size(), false);
94
+ ostr->write(ret.data(), ret.data() + ret.size(), false);
95
95
  }
96
96
  },
97
97
  request.current()));