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
@@ -0,0 +1,40 @@
1
+ // Copyright (c) ZeroC, Inc.
2
+
3
+ #ifndef ICE_TCP_BUF_SIZE_H
4
+ #define ICE_TCP_BUF_SIZE_H
5
+
6
+ #include "Ice/Properties.h"
7
+
8
+ #include <cstdint>
9
+
10
+ namespace IceInternal
11
+ {
12
+ // The TCP send and receive buffer sizes, as configured by the Ice.TCP.SndSize and Ice.TCP.RcvSize properties.
13
+ class TcpBufSize
14
+ {
15
+ public:
16
+ // Reads the Ice.TCP.RcvSize and Ice.TCP.SndSize properties. Throws PropertyException if a value is not a
17
+ // valid integer.
18
+ explicit TcpBufSize(const Ice::PropertiesPtr& properties)
19
+ : _rcvSize(properties->getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize)),
20
+ _sndSize(properties->getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize))
21
+ {
22
+ }
23
+
24
+ [[nodiscard]] std::int32_t rcvSize() const noexcept { return _rcvSize; }
25
+ [[nodiscard]] std::int32_t sndSize() const noexcept { return _sndSize; }
26
+
27
+ private:
28
+ // By default, on Windows we use a 128KB buffer size. On Unix platforms, we use the system defaults.
29
+ #ifdef _WIN32
30
+ static constexpr std::int32_t dfltBufSize = 128 * 1024;
31
+ #else
32
+ static constexpr std::int32_t dfltBufSize = 0;
33
+ #endif
34
+
35
+ std::int32_t _rcvSize;
36
+ std::int32_t _sndSize;
37
+ };
38
+ }
39
+
40
+ #endif
@@ -22,7 +22,9 @@ using namespace IceInternal;
22
22
  TransceiverPtr
23
23
  IceInternal::TcpConnector::connect()
24
24
  {
25
- return make_shared<TcpTransceiver>(_instance, make_shared<StreamSocket>(_instance, _proxy, _addr, _sourceAddr));
25
+ return make_shared<TcpTransceiver>(
26
+ _instance,
27
+ make_shared<StreamSocket>(_instance, _proxy, _addr, _sourceAddr, _bufSize));
26
28
  }
27
29
 
28
30
  int16_t
@@ -120,7 +122,8 @@ IceInternal::TcpConnector::TcpConnector(
120
122
  _proxy(std::move(proxy)),
121
123
  _sourceAddr(sourceAddr),
122
124
  _timeout(timeout),
123
- _connectionId(std::move(connectionId))
125
+ _connectionId(std::move(connectionId)),
126
+ _bufSize(_instance->properties())
124
127
  {
125
128
  }
126
129
 
@@ -6,6 +6,7 @@
6
6
  #include "Connector.h"
7
7
  #include "Network.h"
8
8
  #include "ProtocolInstanceF.h"
9
+ #include "TcpBufSize.h"
9
10
  #include "TransceiverF.h"
10
11
 
11
12
  namespace IceInternal
@@ -30,6 +31,7 @@ namespace IceInternal
30
31
  const Address _sourceAddr;
31
32
  const std::int32_t _timeout;
32
33
  const std::string _connectionId;
34
+ const TcpBufSize _bufSize;
33
35
  };
34
36
  }
35
37
 
@@ -113,6 +113,10 @@ IceInternal::TcpTransceiver::getInfo(bool incoming, string adapterName, string c
113
113
  string remoteAddress;
114
114
  int remotePort;
115
115
  fdToAddressAndPort(_stream->fd(), localAddress, localPort, remoteAddress, remotePort);
116
+
117
+ int rcvSize = getRecvBufferSizeNoThrow(_stream->fd());
118
+ int sndSize = getSendBufferSizeNoThrow(_stream->fd());
119
+
116
120
  return make_shared<TCPConnectionInfo>(
117
121
  incoming,
118
122
  std::move(adapterName),
@@ -121,8 +125,8 @@ IceInternal::TcpTransceiver::getInfo(bool incoming, string adapterName, string c
121
125
  localPort,
122
126
  std::move(remoteAddress),
123
127
  remotePort,
124
- getRecvBufferSize(_stream->fd()),
125
- getSendBufferSize(_stream->fd()));
128
+ rcvSize,
129
+ sndSize);
126
130
  }
127
131
  }
128
132
 
@@ -468,12 +468,6 @@ IceInternal::ThreadPool::joinWithAllThreads()
468
468
  _selector.destroy();
469
469
  }
470
470
 
471
- string
472
- IceInternal::ThreadPool::prefix() const
473
- {
474
- return _prefix;
475
- }
476
-
477
471
  void
478
472
  IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
479
473
  {
@@ -554,7 +548,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
554
548
  {
555
549
  //
556
550
  // If the handler called ioCompleted(), we re-enable the handler in
557
- // case it was disabled and we decrease the number of thread in use.
551
+ // case it was disabled and we decrease the number of threads in use.
558
552
  //
559
553
  if (_serialize && current._handler.get() != _workQueue.get())
560
554
  {
@@ -805,7 +799,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current)
805
799
  }
806
800
  }
807
801
 
808
- return _serialize && current._handler.get() != _workQueue.get();
802
+ return _sizeMax > 1 && _serialize && current._handler.get() != _workQueue.get();
809
803
  }
810
804
 
811
805
  #if defined(ICE_USE_IOCP)
@@ -73,8 +73,6 @@ namespace IceInternal
73
73
 
74
74
  void joinWithAllThreads();
75
75
 
76
- [[nodiscard]] std::string prefix() const;
77
-
78
76
  private:
79
77
  ThreadPool(const InstancePtr&, std::string, int);
80
78
  void initialize();
@@ -19,6 +19,10 @@ Timer::destroy()
19
19
  {
20
20
  throw std::runtime_error("a timer task cannot destroy the timer");
21
21
  }
22
+ // Destroy the tasks after the lock is released and the worker joined: a task's destructor can re-enter the timer
23
+ // via cancel() (e.g. when it holds the last reference to a connection), which would deadlock while _mutex is held.
24
+ std::set<Token> tokens;
25
+ std::map<TimerTaskPtr, std::chrono::steady_clock::time_point> tasks;
22
26
  {
23
27
  std::lock_guard lock(_mutex);
24
28
  if (_destroyed)
@@ -26,8 +30,8 @@ Timer::destroy()
26
30
  return;
27
31
  }
28
32
  _destroyed = true;
29
- _tasks.clear();
30
- _tokens.clear();
33
+ tokens.swap(_tokens);
34
+ tasks.swap(_tasks);
31
35
  _condition.notify_one();
32
36
  }
33
37
  _worker.join();
@@ -135,7 +139,7 @@ Timer::run()
135
139
  {
136
140
  // If the task is not a repeated task, clear the task reference now rather than
137
141
  // in the synchronization block above. Clearing the task reference might end up
138
- // calling user code which could trigger a deadlock. See also issue #352.
142
+ // calling user code which could trigger a deadlock.
139
143
  token.task = nullptr;
140
144
  }
141
145
  }
@@ -2,8 +2,7 @@
2
2
 
3
3
  #include "Ice/UUID.h"
4
4
 
5
- // We use a high quality random number generator
6
- // (std::random_device) to generate "version 4" UUIDs, as described in
5
+ // We use the operating system's CSPRNG (see Random.h) to generate "version 4" UUIDs, as described in
7
6
  // http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-00.txt
8
7
  #include "Random.h"
9
8
 
@@ -227,7 +227,10 @@ IceInternal::UdpEndpointI::options() const
227
227
  if (_mcastInterface.length() > 0)
228
228
  {
229
229
  s << " --interface ";
230
- bool addQuote = _mcastInterface.find(':') != string::npos;
230
+ // Quote the interface if it contains a character that would be re-parsed as a separator: whitespace, on
231
+ // which the endpoint parser splits options (e.g. a Windows adapter name like "Ethernet 2"), or ':', on
232
+ // which the proxy-string parser splits endpoints (e.g. an IPv6 interface address).
233
+ bool addQuote = _mcastInterface.find_first_of(" :\t\n\r") != string::npos;
231
234
  if (addQuote)
232
235
  {
233
236
  s << "\"";
@@ -69,36 +69,49 @@ IceInternal::UdpTransceiver::closing(bool, exception_ptr)
69
69
  void
70
70
  IceInternal::UdpTransceiver::close()
71
71
  {
72
- assert(_fd != INVALID_SOCKET);
73
- SOCKET fd = _fd;
74
- _fd = INVALID_SOCKET;
75
- closeSocket(fd);
72
+ // _fd can be INVALID_SOCKET when bind failed: the bind/setup helper that threw already closed the socket, and
73
+ // bind()'s catch reset _fd.
74
+ if (_fd != INVALID_SOCKET)
75
+ {
76
+ closeSocketNoThrow(_fd);
77
+ _fd = INVALID_SOCKET;
78
+ }
76
79
  }
77
80
 
78
81
  EndpointIPtr
79
82
  IceInternal::UdpTransceiver::bind()
80
83
  {
81
- if (isMulticast(_addr))
84
+ try
82
85
  {
83
- // Set SO_REUSEADDR socket option to allow multiple sockets to bind to the same multicast address.
84
- setReuseAddress(_fd, true);
85
- _mcastAddr = _addr;
86
+ if (isMulticast(_addr))
87
+ {
88
+ // Set SO_REUSEADDR socket option to allow multiple sockets to bind to the same multicast address.
89
+ setReuseAddress(_fd, true);
90
+ _mcastAddr = _addr;
86
91
 
87
92
  #ifdef _WIN32
88
- // Windows does not allow binding to the mcast address itself so we bind to INADDR_ANY instead.
89
- const_cast<Address&>(_addr) = getAddressForServer("", _port, getProtocolSupport(_addr), false, false);
93
+ // Windows does not allow binding to the mcast address itself so we bind to INADDR_ANY instead.
94
+ const_cast<Address&>(_addr) = getAddressForServer("", _port, getProtocolSupport(_addr), false, false);
90
95
  #endif
91
96
 
92
- const_cast<Address&>(_addr) = doBind(_fd, _addr, _mcastInterface);
93
- if (getPort(_mcastAddr) == 0)
97
+ const_cast<Address&>(_addr) = doBind(_fd, _addr, _mcastInterface);
98
+ if (getPort(_mcastAddr) == 0)
99
+ {
100
+ setPort(_mcastAddr, getPort(_addr));
101
+ }
102
+ setMcastGroup(_fd, _mcastAddr, _mcastInterface);
103
+ }
104
+ else
94
105
  {
95
- setPort(_mcastAddr, getPort(_addr));
106
+ const_cast<Address&>(_addr) = doBind(_fd, _addr);
96
107
  }
97
- setMcastGroup(_fd, _mcastAddr, _mcastInterface);
98
108
  }
99
- else
109
+ catch (...)
100
110
  {
101
- const_cast<Address&>(_addr) = doBind(_fd, _addr);
111
+ // setReuseAddress/doBind/setMcastGroup close the socket before throwing, so reset _fd to avoid a double
112
+ // close when close() runs during cleanup. Mirrors TcpAcceptor::listen.
113
+ _fd = INVALID_SOCKET;
114
+ throw;
102
115
  }
103
116
 
104
117
  _bound = true;
@@ -173,6 +186,18 @@ repeat:
173
186
  return SocketOperationWrite;
174
187
  }
175
188
 
189
+ #ifndef _WIN32
190
+ // ENOBUFS means the local send buffer is momentarily full. This is routine on macOS/BSD during bursts
191
+ // and is a transient local condition rather than a connection failure. UDP is best-effort, so drop this
192
+ // datagram instead of throwing (throwing would needlessly close the connection). Limited to non-Windows:
193
+ // there noBuffers() also matches WSAEFAULT, which must not be silently dropped.
194
+ if (noBuffers())
195
+ {
196
+ buf.i = buf.b.end();
197
+ return SocketOperationNone;
198
+ }
199
+ #endif
200
+
176
201
  throw SocketException(__FILE__, __LINE__, getSocketErrno());
177
202
  }
178
203
 
@@ -561,10 +586,73 @@ IceInternal::UdpTransceiver::checkSendSize(const Buffer& buf)
561
586
  }
562
587
  }
563
588
 
589
+ //
590
+ // Set UDP receive and send buffer sizes.
591
+ //
564
592
  void
565
593
  IceInternal::UdpTransceiver::setBufferSize(int rcvSize, int sndSize)
566
594
  {
567
- setBufSize(rcvSize, sndSize);
595
+ assert(_fd != INVALID_SOCKET);
596
+
597
+ try
598
+ {
599
+ // The default size is the size currently configured on the socket. We don't set the buffer size when the
600
+ // requested size matches the default: re-setting it would needlessly grow the buffer on systems (e.g. Linux)
601
+ // where the kernel doubles the value on each set.
602
+
603
+ int rcvDefault = getRecvBufferSize(_fd);
604
+ rcvSize = adjustBufferSize(rcvSize, rcvDefault, "Ice.UDP.RcvSize");
605
+ if (rcvSize == rcvDefault)
606
+ {
607
+ _rcvSize = rcvDefault;
608
+ }
609
+ else
610
+ {
611
+ // The kernel silently adjusts the size to an acceptable value, so read it back to get the size actually
612
+ // set.
613
+ setRecvBufferSize(_fd, rcvSize);
614
+ _rcvSize = getRecvBufferSize(_fd);
615
+ if (_rcvSize < rcvSize)
616
+ {
617
+ // The kernel reduced the requested size; warn unless we already warned for this size.
618
+ BufSizeWarnInfo winfo = _instance->getBufSizeWarn(UDPEndpointType);
619
+ if (!winfo.rcvWarn || winfo.rcvSize != rcvSize)
620
+ {
621
+ Warning out(_instance->logger());
622
+ out << "UDP receive buffer size: requested size of " << rcvSize << " adjusted to " << _rcvSize;
623
+ _instance->setRcvBufSizeWarn(UDPEndpointType, rcvSize);
624
+ }
625
+ }
626
+ }
627
+
628
+ int sndDefault = getSendBufferSize(_fd);
629
+ sndSize = adjustBufferSize(sndSize, sndDefault, "Ice.UDP.SndSize");
630
+ if (sndSize == sndDefault)
631
+ {
632
+ _sndSize = sndDefault;
633
+ }
634
+ else
635
+ {
636
+ setSendBufferSize(_fd, sndSize);
637
+ _sndSize = getSendBufferSize(_fd);
638
+ if (_sndSize < sndSize)
639
+ {
640
+ BufSizeWarnInfo winfo = _instance->getBufSizeWarn(UDPEndpointType);
641
+ if (!winfo.sndWarn || winfo.sndSize != sndSize)
642
+ {
643
+ Warning out(_instance->logger());
644
+ out << "UDP send buffer size: requested size of " << sndSize << " adjusted to " << _sndSize;
645
+ _instance->setSndBufSizeWarn(UDPEndpointType, sndSize);
646
+ }
647
+ }
648
+ }
649
+ }
650
+ catch (const SocketException&)
651
+ {
652
+ // The failing call closed the fd.
653
+ clearFd();
654
+ throw;
655
+ }
568
656
  }
569
657
 
570
658
  int
@@ -590,8 +678,15 @@ IceInternal::UdpTransceiver::UdpTransceiver(
590
678
  _write(SocketOperationWrite)
591
679
  #endif
592
680
  {
681
+ int rcvSize = _instance->properties()->getIcePropertyAsInt("Ice.UDP.RcvSize");
682
+ int sndSize = _instance->properties()->getIcePropertyAsInt("Ice.UDP.SndSize");
593
683
  _fd = createSocket(true, _addr);
594
- setBufSize(-1, -1);
684
+
685
+ // Sets _rcvSize and _sndSize:
686
+ setBufferSize(rcvSize, sndSize);
687
+ assert(_rcvSize >= _udpOverhead + headerSize);
688
+ assert(_sndSize >= _udpOverhead + headerSize);
689
+
595
690
  setBlock(_fd, false);
596
691
 
597
692
  _mcastAddr.saStorage.ss_family = AF_UNSPEC;
@@ -614,8 +709,8 @@ IceInternal::UdpTransceiver::UdpTransceiver(
614
709
  }
615
710
 
616
711
  //
617
- // In general, connecting a datagram socket should be non-blocking as this just setups
618
- // the default destination address for the socket. However, on some OS, connect sometime
712
+ // In general, connecting a datagram socket should be non-blocking as this just sets up
713
+ // the default destination address for the socket. However, on some OS, connect sometimes
619
714
  // returns EWOULDBLOCK. If that's the case, we keep the state as StateNeedConnect. This
620
715
  // will make sure the transceiver is notified when the socket is ready for sending (see
621
716
  // the initialize() implementation).
@@ -658,8 +753,15 @@ IceInternal::UdpTransceiver::UdpTransceiver(
658
753
  _write(SocketOperationWrite)
659
754
  #endif
660
755
  {
756
+ int rcvSize = _instance->properties()->getIcePropertyAsInt("Ice.UDP.RcvSize");
757
+ int sndSize = _instance->properties()->getIcePropertyAsInt("Ice.UDP.SndSize");
661
758
  _fd = createServerSocket(true, _addr, instance->protocolSupport());
662
- setBufSize(-1, -1);
759
+
760
+ // Sets _rcvSize and _sndSize:
761
+ setBufferSize(rcvSize, sndSize);
762
+ assert(_rcvSize >= _udpOverhead + headerSize);
763
+ assert(_sndSize >= _udpOverhead + headerSize);
764
+
663
765
  setBlock(_fd, false);
664
766
 
665
767
  memset(&_mcastAddr.saStorage, 0, sizeof(sockaddr_storage));
@@ -670,112 +772,23 @@ IceInternal::UdpTransceiver::UdpTransceiver(
670
772
 
671
773
  IceInternal::UdpTransceiver::~UdpTransceiver() { assert(_fd == INVALID_SOCKET); }
672
774
 
673
- //
674
- // Set UDP receive and send buffer sizes.
675
- //
676
- void
677
- IceInternal::UdpTransceiver::setBufSize(int rcvSize, int sndSize)
775
+ int
776
+ IceInternal::UdpTransceiver::adjustBufferSize(int sizeRequested, int defaultSize, string_view prop)
678
777
  {
679
- assert(_fd != INVALID_SOCKET);
680
-
681
- for (int i = 0; i < 2; ++i)
778
+ if (sizeRequested == 0)
682
779
  {
683
- bool isSnd;
684
- string direction;
685
- string prop;
686
- int* addr;
687
- int dfltSize;
688
- int sizeRequested;
689
- if (i == 0)
690
- {
691
- isSnd = false;
692
- direction = "receive";
693
- prop = "Ice.UDP.RcvSize";
694
- addr = &_rcvSize;
695
- dfltSize = getRecvBufferSize(_fd);
696
- sizeRequested = rcvSize;
697
- }
698
- else
699
- {
700
- isSnd = true;
701
- direction = "send";
702
- prop = "Ice.UDP.SndSize";
703
- addr = &_sndSize;
704
- dfltSize = getSendBufferSize(_fd);
705
- sizeRequested = sndSize;
706
- }
707
-
708
- if (dfltSize <= 0)
709
- {
710
- dfltSize = _maxPacketSize;
711
- }
712
- *addr = dfltSize;
713
-
714
- //
715
- // Get property for buffer size if size not passed in.
716
- //
717
- if (sizeRequested == -1)
718
- {
719
- sizeRequested = _instance->properties()->getPropertyAsIntWithDefault(prop, dfltSize);
720
- }
721
- //
722
- // Check for sanity.
723
- //
724
- if (sizeRequested < (_udpOverhead + headerSize))
725
- {
726
- Warning out(_instance->logger());
727
- out << "Invalid " << prop << " value of " << sizeRequested << " adjusted to " << dfltSize;
728
- sizeRequested = dfltSize;
729
- }
730
-
731
- if (sizeRequested != dfltSize)
732
- {
733
- //
734
- // Try to set the buffer size. The kernel will silently adjust
735
- // the size to an acceptable value. Then read the size back to
736
- // get the size that was actually set.
737
- //
738
- if (i == 0)
739
- {
740
- setRecvBufferSize(_fd, sizeRequested);
741
- *addr = getRecvBufferSize(_fd);
742
- }
743
- else
744
- {
745
- setSendBufferSize(_fd, sizeRequested);
746
- *addr = getSendBufferSize(_fd);
747
- }
780
+ // 0 (the property default) means we want the default size.
781
+ return defaultSize;
782
+ }
748
783
 
749
- //
750
- // Warn if the size that was set is less than the requested size and
751
- // we have not already warned.
752
- //
753
- if (*addr == 0) // set buffer size not supported.
754
- {
755
- *addr = sizeRequested;
756
- }
757
- else if (*addr < sizeRequested)
758
- {
759
- BufSizeWarnInfo winfo = _instance->getBufSizeWarn(UDPEndpointType);
760
- if ((isSnd && (!winfo.sndWarn || winfo.sndSize != sizeRequested)) ||
761
- (!isSnd && (!winfo.rcvWarn || winfo.rcvSize != sizeRequested)))
762
- {
763
- Warning out(_instance->logger());
764
- out << "UDP " << direction << " buffer size: requested size of " << sizeRequested << " adjusted to "
765
- << *addr;
766
-
767
- if (isSnd)
768
- {
769
- _instance->setSndBufSizeWarn(UDPEndpointType, sizeRequested);
770
- }
771
- else
772
- {
773
- _instance->setRcvBufSizeWarn(UDPEndpointType, sizeRequested);
774
- }
775
- }
776
- }
777
- }
784
+ if (sizeRequested < _udpOverhead + headerSize)
785
+ {
786
+ Warning out(_instance->logger());
787
+ out << "Invalid " << prop << " value of " << sizeRequested << " adjusted to " << defaultSize;
788
+ return defaultSize;
778
789
  }
790
+
791
+ return sizeRequested;
779
792
  }
780
793
 
781
794
  //
@@ -9,7 +9,6 @@
9
9
 
10
10
  namespace IceInternal
11
11
  {
12
- class UdpEndpoint;
13
12
 
14
13
  class UdpTransceiver final : public Transceiver,
15
14
  public NativeInfo,
@@ -57,7 +56,7 @@ namespace IceInternal
57
56
  [[nodiscard]] int effectivePort() const;
58
57
 
59
58
  private:
60
- void setBufSize(int, int);
59
+ int adjustBufferSize(int sizeRequested, int defaultSize, std::string_view prop);
61
60
 
62
61
  UdpEndpointIPtr _endpoint;
63
62
  const ProtocolInstancePtr _instance;
@@ -74,8 +73,8 @@ namespace IceInternal
74
73
  #endif
75
74
 
76
75
  State _state;
77
- int _rcvSize;
78
- int _sndSize;
76
+ int _rcvSize{0};
77
+ int _sndSize{0};
79
78
  static const int _udpOverhead;
80
79
  static const int _maxPacketSize;
81
80