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
@@ -10,7 +10,8 @@ StreamSocket::StreamSocket(
10
10
  ProtocolInstancePtr instance,
11
11
  const NetworkProxyPtr& proxy,
12
12
  const Address& addr,
13
- const Address& sourceAddr)
13
+ const Address& sourceAddr,
14
+ const TcpBufSize& bufSize)
14
15
  : NativeInfo(createSocket(false, proxy ? proxy->getAddress() : addr)),
15
16
  _instance(std::move(instance)),
16
17
  _proxy(proxy),
@@ -23,25 +24,17 @@ StreamSocket::StreamSocket(
23
24
  _write(SocketOperationWrite)
24
25
  #endif
25
26
  {
26
- init();
27
+ init(bufSize);
27
28
  #if !defined(ICE_USE_IOCP)
28
29
  if (doConnect(_fd, _proxy ? _proxy->getAddress() : _addr, sourceAddr))
29
30
  {
30
31
  _state = _proxy ? StateProxyWrite : StateConnected;
31
32
  }
32
33
  #endif
33
- try
34
- {
35
- _desc = fdToString(_fd, _proxy, _addr);
36
- }
37
- catch (const Ice::Exception&)
38
- {
39
- closeSocketNoThrow(_fd);
40
- throw;
41
- }
34
+ _desc = fdToString(_fd, _proxy, _addr);
42
35
  }
43
36
 
44
- StreamSocket::StreamSocket(ProtocolInstancePtr instance, SOCKET fd)
37
+ StreamSocket::StreamSocket(ProtocolInstancePtr instance, SOCKET fd, const TcpBufSize& bufSize)
45
38
  : NativeInfo(fd),
46
39
  _instance(std::move(instance)),
47
40
  _addr(),
@@ -53,16 +46,8 @@ StreamSocket::StreamSocket(ProtocolInstancePtr instance, SOCKET fd)
53
46
  _write(SocketOperationWrite)
54
47
  #endif
55
48
  {
56
- init();
57
- try
58
- {
59
- _desc = fdToString(fd);
60
- }
61
- catch (const Ice::Exception&)
62
- {
63
- closeSocketNoThrow(fd);
64
- throw;
65
- }
49
+ init(bufSize);
50
+ _desc = fdToString(fd);
66
51
  }
67
52
 
68
53
  StreamSocket::~StreamSocket() { assert(_fd == INVALID_SOCKET); }
@@ -113,16 +98,19 @@ StreamSocket::connect(Buffer& readBuffer, Buffer& writeBuffer)
113
98
  return IceInternal::SocketOperationNone;
114
99
  }
115
100
 
116
- bool
117
- StreamSocket::isConnected()
118
- {
119
- return _state == StateConnected && _fd != INVALID_SOCKET;
120
- }
121
-
122
101
  void
123
102
  StreamSocket::setBufferSize(int rcvSize, int sndSize)
124
103
  {
125
- setTcpBufSize(_fd, rcvSize, sndSize, _instance);
104
+ try
105
+ {
106
+ setTcpBufSize(_fd, rcvSize, sndSize, _instance);
107
+ }
108
+ catch (const Ice::SocketException&)
109
+ {
110
+ // The failing call closed the fd.
111
+ clearFd();
112
+ throw;
113
+ }
126
114
  }
127
115
 
128
116
  SocketOperation
@@ -431,16 +419,19 @@ StreamSocket::finishRead(Buffer& buf)
431
419
  void
432
420
  StreamSocket::close()
433
421
  {
434
- assert(_fd != INVALID_SOCKET);
435
- try
422
+ // _fd can be INVALID_SOCKET when a failed socket operation already closed the fd.
423
+ if (_fd != INVALID_SOCKET)
436
424
  {
437
- closeSocket(_fd);
438
- _fd = INVALID_SOCKET;
439
- }
440
- catch (const Ice::SocketException&)
441
- {
442
- _fd = INVALID_SOCKET;
443
- throw;
425
+ try
426
+ {
427
+ closeSocket(_fd);
428
+ _fd = INVALID_SOCKET;
429
+ }
430
+ catch (const Ice::SocketException&)
431
+ {
432
+ _fd = INVALID_SOCKET;
433
+ throw;
434
+ }
444
435
  }
445
436
  }
446
437
 
@@ -451,10 +442,12 @@ StreamSocket::toString() const
451
442
  }
452
443
 
453
444
  void
454
- StreamSocket::init()
445
+ StreamSocket::init(const TcpBufSize& bufSize)
455
446
  {
447
+ // Both calls close the fd before throwing a SocketException, so a failure cannot leak the fd — and since init
448
+ // is only called from constructors, the exception abandons the object and nothing uses the stale _fd afterward.
456
449
  setBlock(_fd, false);
457
- setTcpBufSize(_fd, _instance);
450
+ setTcpBufSize(_fd, bufSize.rcvSize(), bufSize.sndSize(), _instance);
458
451
  }
459
452
 
460
453
  StreamSocket::State
@@ -6,6 +6,7 @@
6
6
  #include "Ice/Buffer.h"
7
7
  #include "Network.h"
8
8
  #include "ProtocolInstanceF.h"
9
+ #include "TcpBufSize.h"
9
10
 
10
11
  #include <memory>
11
12
 
@@ -14,12 +15,11 @@ namespace IceInternal
14
15
  class StreamSocket : public NativeInfo
15
16
  {
16
17
  public:
17
- StreamSocket(ProtocolInstancePtr, const NetworkProxyPtr&, const Address&, const Address&);
18
- StreamSocket(ProtocolInstancePtr, SOCKET);
18
+ StreamSocket(ProtocolInstancePtr, const NetworkProxyPtr&, const Address&, const Address&, const TcpBufSize&);
19
+ StreamSocket(ProtocolInstancePtr, SOCKET, const TcpBufSize&);
19
20
  ~StreamSocket() override;
20
21
 
21
22
  SocketOperation connect(Buffer&, Buffer&);
22
- bool isConnected();
23
23
 
24
24
  void setBufferSize(int rcvSize, int sndSize);
25
25
 
@@ -41,7 +41,7 @@ namespace IceInternal
41
41
  [[nodiscard]] const std::string& toString() const;
42
42
 
43
43
  private:
44
- void init();
44
+ void init(const TcpBufSize&);
45
45
 
46
46
  enum State
47
47
  {
@@ -483,7 +483,7 @@ namespace
483
483
  wstring wbuffer;
484
484
 
485
485
  //
486
- // The following code pages doesn't support MB_ERR_INVALID_CHARS flag
486
+ // The following code pages don't support the MB_ERR_INVALID_CHARS flag
487
487
  // see http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx
488
488
  //
489
489
  DWORD flags = (_cp == 50220 || _cp == 50221 || _cp == 50222 || _cp == 50225 || _cp == 50227 || _cp == 50229 ||
@@ -337,6 +337,7 @@ namespace
337
337
  // end marks the one-past-the-end position of the substring to be scanned.
338
338
  // nextStart is set to the index of the first character following the decoded
339
339
  // character or escape sequence.
340
+ // Returns true if the decoded character is pure ASCII (<= 127), false otherwise.
340
341
  //
341
342
  bool decodeChar(
342
343
  const string& s,
@@ -353,6 +354,10 @@ namespace
353
354
 
354
355
  if (s[start] != '\\')
355
356
  {
357
+ if (static_cast<unsigned char>(s[start]) > 127)
358
+ {
359
+ pureASCII = false;
360
+ }
356
361
  result.push_back(checkChar(s, start++));
357
362
  }
358
363
  else if (start + 1 == end)
@@ -585,7 +590,7 @@ IceInternal::unescapeString(
585
590
  {
586
591
  checkChar(s, p++);
587
592
  }
588
- return s.substr(start, end);
593
+ return s.substr(start, end - start);
589
594
  }
590
595
  else
591
596
  {
@@ -605,7 +610,7 @@ IceInternal::unescapeString(
605
610
 
606
611
  if (!inputIsPureASCII)
607
612
  {
608
- u8s = nativeToUTF8(s.substr(start, end), stringConverter);
613
+ u8s = nativeToUTF8(s.substr(start, end - start), stringConverter);
609
614
  inputStringPtr = &u8s;
610
615
  start = 0;
611
616
  end = u8s.size();
@@ -617,7 +622,7 @@ IceInternal::unescapeString(
617
622
  result.reserve(end - start);
618
623
  while (start < end)
619
624
  {
620
- if (decodeChar(*inputStringPtr, start, end, start, special, result))
625
+ if (!decodeChar(*inputStringPtr, start, end, start, special, result))
621
626
  {
622
627
  resultIsPureASCII = false;
623
628
  }
@@ -801,7 +806,7 @@ IceInternal::match(const string& s, const string& pat, bool emptyMatch)
801
806
  //
802
807
  // Make sure end of the strings match
803
808
  //
804
- if (s.substr(endIndex, s.length()) != pat.substr(beginIndex + 1, pat.length()))
809
+ if (s.substr(endIndex) != pat.substr(beginIndex + 1))
805
810
  {
806
811
  return false;
807
812
  }
@@ -1032,10 +1037,10 @@ IceInternal::errorToString(int error)
1032
1037
  //
1033
1038
  // Use the XSI-compliant version of strerror_r
1034
1039
  //
1035
- int err = strerror_r(error, &buffer[0], buffer.size());
1040
+ int err = strerror_r(error, buffer.data(), buffer.size());
1036
1041
  if (err == 0)
1037
1042
  {
1038
- return {&buffer[0]};
1043
+ return {buffer.data()};
1039
1044
  }
1040
1045
  # else
1041
1046
  //
@@ -1043,7 +1048,7 @@ IceInternal::errorToString(int error)
1043
1048
  //
1044
1049
  int oerrno = errno;
1045
1050
  errno = 0;
1046
- const char* msg = strerror_r(error, &buffer[0], buffer.size());
1051
+ const char* msg = strerror_r(error, buffer.data(), buffer.size());
1047
1052
  int err = errno;
1048
1053
  errno = oerrno;
1049
1054
  if (err == 0)
@@ -1121,17 +1126,3 @@ IceInternal::isDigit(char c)
1121
1126
  {
1122
1127
  return c >= '0' && c <= '9';
1123
1128
  }
1124
-
1125
- string
1126
- IceInternal::removeWhitespace(string_view s)
1127
- {
1128
- string result;
1129
- for (unsigned int i = 0; i < s.length(); ++i)
1130
- {
1131
- if (!isspace(static_cast<unsigned char>(s[i])))
1132
- {
1133
- result += s[i];
1134
- }
1135
- }
1136
- return result;
1137
- }
@@ -4,145 +4,181 @@
4
4
 
5
5
  # include "SysLoggerI.h"
6
6
  # include "Ice/LocalExceptions.h"
7
+
8
+ # include <mutex>
7
9
  # include <syslog.h>
8
10
 
9
11
  using namespace std;
10
12
  using namespace Ice;
11
13
  using namespace IceInternal;
12
14
 
13
- Ice::SysLoggerI::SysLoggerI(string prefix, string_view facilityString) : _facility(0), _prefix(std::move(prefix))
15
+ namespace
14
16
  {
15
- if (facilityString == "LOG_KERN")
16
- {
17
- _facility = LOG_KERN;
18
- }
19
- else if (facilityString == "LOG_USER")
20
- {
21
- _facility = LOG_USER;
22
- }
23
- else if (facilityString == "LOG_MAIL")
24
- {
25
- _facility = LOG_MAIL;
26
- }
27
- else if (facilityString == "LOG_DAEMON")
28
- {
29
- _facility = LOG_DAEMON;
30
- }
31
- else if (facilityString == "LOG_AUTH")
32
- {
33
- _facility = LOG_AUTH;
34
- }
35
- else if (facilityString == "LOG_SYSLOG")
36
- {
37
- _facility = LOG_SYSLOG;
38
- }
39
- else if (facilityString == "LOG_LPR")
40
- {
41
- _facility = LOG_LPR;
42
- }
43
- else if (facilityString == "LOG_NEWS")
44
- {
45
- _facility = LOG_NEWS;
46
- }
47
- else if (facilityString == "LOG_UUCP")
48
- {
49
- _facility = LOG_UUCP;
50
- }
51
- else if (facilityString == "LOG_CRON")
52
- {
53
- _facility = LOG_CRON;
54
- }
17
+ // openlog/closelog and the syslog ident are process-global, and openlog retains the ident pointer rather than
18
+ // copying it. All SysLoggerI instances therefore share a single openlog call: the first instance donates its
19
+ // prefix as the process-wide ident, and the last instance to be destroyed calls closelog. sysLogMutex guards
20
+ // this state and serializes the syslog calls.
21
+ mutex sysLogMutex;
22
+ int sysLogCount = 0;
23
+
24
+ // Intentionally leaked: openlog retains the ident pointer, and a logger stored in a global can still call syslog
25
+ // during static destruction, so this buffer must never be freed.
26
+ string& sysLogIdent = *new string; // NOLINT(cert-err58-cpp)
27
+
28
+ int parseFacility(string_view facilityString)
29
+ {
30
+ if (facilityString == "LOG_KERN")
31
+ {
32
+ return LOG_KERN;
33
+ }
34
+ else if (facilityString == "LOG_USER")
35
+ {
36
+ return LOG_USER;
37
+ }
38
+ else if (facilityString == "LOG_MAIL")
39
+ {
40
+ return LOG_MAIL;
41
+ }
42
+ else if (facilityString == "LOG_DAEMON")
43
+ {
44
+ return LOG_DAEMON;
45
+ }
46
+ else if (facilityString == "LOG_AUTH")
47
+ {
48
+ return LOG_AUTH;
49
+ }
50
+ else if (facilityString == "LOG_SYSLOG")
51
+ {
52
+ return LOG_SYSLOG;
53
+ }
54
+ else if (facilityString == "LOG_LPR")
55
+ {
56
+ return LOG_LPR;
57
+ }
58
+ else if (facilityString == "LOG_NEWS")
59
+ {
60
+ return LOG_NEWS;
61
+ }
62
+ else if (facilityString == "LOG_UUCP")
63
+ {
64
+ return LOG_UUCP;
65
+ }
66
+ else if (facilityString == "LOG_CRON")
67
+ {
68
+ return LOG_CRON;
69
+ }
55
70
  # ifdef LOG_AUTHPRIV
56
- else if (facilityString == "LOG_AUTHPRIV")
57
- {
58
- _facility = LOG_AUTHPRIV;
59
- }
71
+ else if (facilityString == "LOG_AUTHPRIV")
72
+ {
73
+ return LOG_AUTHPRIV;
74
+ }
60
75
  # endif
61
76
  # ifdef LOG_FTP
62
- else if (facilityString == "LOG_FTP")
63
- {
64
- _facility = LOG_FTP;
65
- }
77
+ else if (facilityString == "LOG_FTP")
78
+ {
79
+ return LOG_FTP;
80
+ }
66
81
  # endif
67
- else if (facilityString == "LOG_LOCAL0")
68
- {
69
- _facility = LOG_LOCAL0;
70
- }
71
- else if (facilityString == "LOG_LOCAL1")
72
- {
73
- _facility = LOG_LOCAL1;
74
- }
75
- else if (facilityString == "LOG_LOCAL2")
76
- {
77
- _facility = LOG_LOCAL2;
78
- }
79
- else if (facilityString == "LOG_LOCAL3")
80
- {
81
- _facility = LOG_LOCAL3;
82
- }
83
- else if (facilityString == "LOG_LOCAL4")
84
- {
85
- _facility = LOG_LOCAL4;
86
- }
87
- else if (facilityString == "LOG_LOCAL5")
88
- {
89
- _facility = LOG_LOCAL5;
90
- }
91
- else if (facilityString == "LOG_LOCAL6")
92
- {
93
- _facility = LOG_LOCAL6;
82
+ else if (facilityString == "LOG_LOCAL0")
83
+ {
84
+ return LOG_LOCAL0;
85
+ }
86
+ else if (facilityString == "LOG_LOCAL1")
87
+ {
88
+ return LOG_LOCAL1;
89
+ }
90
+ else if (facilityString == "LOG_LOCAL2")
91
+ {
92
+ return LOG_LOCAL2;
93
+ }
94
+ else if (facilityString == "LOG_LOCAL3")
95
+ {
96
+ return LOG_LOCAL3;
97
+ }
98
+ else if (facilityString == "LOG_LOCAL4")
99
+ {
100
+ return LOG_LOCAL4;
101
+ }
102
+ else if (facilityString == "LOG_LOCAL5")
103
+ {
104
+ return LOG_LOCAL5;
105
+ }
106
+ else if (facilityString == "LOG_LOCAL6")
107
+ {
108
+ return LOG_LOCAL6;
109
+ }
110
+ else if (facilityString == "LOG_LOCAL7")
111
+ {
112
+ return LOG_LOCAL7;
113
+ }
114
+ else
115
+ {
116
+ throw InitializationException(
117
+ __FILE__,
118
+ __LINE__,
119
+ "Invalid value for Ice.SyslogFacility: " + string{facilityString});
120
+ }
94
121
  }
95
- else if (facilityString == "LOG_LOCAL7")
122
+ }
123
+
124
+ Ice::SysLoggerI::SysLoggerI(string prefix, string_view facilityString)
125
+ : SysLoggerI(std::move(prefix), parseFacility(facilityString))
126
+ {
127
+ }
128
+
129
+ Ice::SysLoggerI::SysLoggerI(string prefix, int facility) : _facility(facility), _prefix(std::move(prefix))
130
+ {
131
+ lock_guard lock(sysLogMutex);
132
+ if (sysLogCount++ == 0)
96
133
  {
97
- _facility = LOG_LOCAL7;
134
+ sysLogIdent = _prefix;
135
+ // The facility argument is only a default for syslog calls that don't specify one; each log method passes
136
+ // this logger's facility with the message priority.
137
+ openlog(sysLogIdent.c_str(), LOG_PID | LOG_CONS, 0);
98
138
  }
99
- else
139
+ if (!_prefix.empty() && _prefix != sysLogIdent)
100
140
  {
101
- throw InitializationException(
102
- __FILE__,
103
- __LINE__,
104
- "Invalid value for Ice.SyslogFacility: " + string{facilityString});
141
+ _bodyPrefix = _prefix + ": ";
105
142
  }
106
-
107
- int logopt = LOG_PID | LOG_CONS;
108
- openlog(_prefix.c_str(), logopt, _facility);
109
143
  }
110
144
 
111
- Ice::SysLoggerI::SysLoggerI(string prefix, int facility) : _facility(facility), _prefix(std::move(prefix))
145
+ Ice::SysLoggerI::~SysLoggerI()
112
146
  {
113
- int logopt = LOG_PID | LOG_CONS;
114
- openlog(_prefix.c_str(), logopt, facility);
147
+ lock_guard lock(sysLogMutex);
148
+ if (--sysLogCount == 0)
149
+ {
150
+ closelog();
151
+ }
115
152
  }
116
153
 
117
- Ice::SysLoggerI::~SysLoggerI() { closelog(); }
118
-
119
154
  void
120
155
  Ice::SysLoggerI::print(const string& message)
121
156
  {
122
- lock_guard lock(_mutex);
123
- syslog(LOG_INFO, "%s", message.c_str());
157
+ // The Logger contract requires these methods not to throw, so we let syslog do the formatting instead of
158
+ // building a std::string that could throw bad_alloc.
159
+ lock_guard lock(sysLogMutex);
160
+ syslog(_facility | LOG_INFO, "%s%s", _bodyPrefix.c_str(), message.c_str());
124
161
  }
125
162
 
126
163
  void
127
164
  Ice::SysLoggerI::trace(const string& category, const string& message)
128
165
  {
129
- lock_guard lock(_mutex);
130
- string s = category + ": " + message;
131
- syslog(LOG_INFO, "%s", s.c_str());
166
+ lock_guard lock(sysLogMutex);
167
+ syslog(_facility | LOG_INFO, "%s%s: %s", _bodyPrefix.c_str(), category.c_str(), message.c_str());
132
168
  }
133
169
 
134
170
  void
135
171
  Ice::SysLoggerI::warning(const string& message)
136
172
  {
137
- lock_guard lock(_mutex);
138
- syslog(LOG_WARNING, "%s", message.c_str());
173
+ lock_guard lock(sysLogMutex);
174
+ syslog(_facility | LOG_WARNING, "%s%s", _bodyPrefix.c_str(), message.c_str());
139
175
  }
140
176
 
141
177
  void
142
178
  Ice::SysLoggerI::error(const string& message)
143
179
  {
144
- lock_guard lock(_mutex);
145
- syslog(LOG_ERR, "%s", message.c_str());
180
+ lock_guard lock(sysLogMutex);
181
+ syslog(_facility | LOG_ERR, "%s%s", _bodyPrefix.c_str(), message.c_str());
146
182
  }
147
183
 
148
184
  string
@@ -5,7 +5,6 @@
5
5
 
6
6
  #include "Ice/Logger.h"
7
7
 
8
- #include <mutex>
9
8
  #include <string_view>
10
9
 
11
10
  namespace Ice
@@ -17,6 +16,9 @@ namespace Ice
17
16
  SysLoggerI(std::string prefix, int facility);
18
17
  ~SysLoggerI() override;
19
18
 
19
+ SysLoggerI(const SysLoggerI&) = delete;
20
+ SysLoggerI& operator=(const SysLoggerI&) = delete;
21
+
20
22
  void print(const std::string&) final;
21
23
  void trace(const std::string&, const std::string&) final;
22
24
  void warning(const std::string&) final;
@@ -25,9 +27,11 @@ namespace Ice
25
27
  LoggerPtr cloneWithPrefix(std::string) final;
26
28
 
27
29
  private:
28
- int _facility;
30
+ const int _facility;
29
31
  const std::string _prefix;
30
- std::mutex _mutex;
32
+
33
+ // Prepended to each message when this logger's prefix differs from the process-wide syslog ident.
34
+ std::string _bodyPrefix;
31
35
  };
32
36
  }
33
37
 
@@ -59,7 +59,7 @@ Ice::SystemdJournalI::write(int priority, const string& message) const
59
59
  priority,
60
60
  "SYSLOG_IDENTIFIER=%s",
61
61
  _prefix.c_str(),
62
- NULL); // Using NULL is necessary for EL7, see #293
62
+ NULL); // The sd_journal_send argument list must be NULL-terminated.
63
63
  }
64
64
 
65
65
  #endif
@@ -96,7 +96,7 @@ IceInternal::TcpAcceptor::startAccept()
96
96
  _acceptFd = createSocket(false, _addr);
97
97
  const int sz = static_cast<int>(_acceptBuf.size() / 2);
98
98
  _info.error = ERROR_SUCCESS;
99
- if (!AcceptEx(_fd, _acceptFd, &_acceptBuf[0], 0, sz, sz, &_info.count, &_info))
99
+ if (!AcceptEx(_fd, _acceptFd, _acceptBuf.data(), 0, sz, sz, &_info.count, &_info))
100
100
  {
101
101
  if (!wouldBlock())
102
102
  {
@@ -123,8 +123,7 @@ IceInternal::TcpAcceptor::accept()
123
123
  {
124
124
  throw SocketException(__FILE__, __LINE__, _acceptError);
125
125
  }
126
- if (setsockopt(_acceptFd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char*)&_acceptFd, sizeof(_acceptFd)) ==
127
- SOCKET_ERROR)
126
+ if (setsockopt(_acceptFd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char*)&_fd, sizeof(_fd)) == SOCKET_ERROR)
128
127
  {
129
128
  closeSocketNoThrow(_acceptFd);
130
129
  _acceptFd = INVALID_SOCKET;
@@ -133,14 +132,14 @@ IceInternal::TcpAcceptor::accept()
133
132
 
134
133
  SOCKET fd = _acceptFd;
135
134
  _acceptFd = INVALID_SOCKET;
136
- return make_shared<TcpTransceiver>(_instance, make_shared<StreamSocket>(_instance, fd));
135
+ return make_shared<TcpTransceiver>(_instance, make_shared<StreamSocket>(_instance, fd, _bufSize));
137
136
  }
138
137
  # else
139
138
 
140
139
  TransceiverPtr
141
140
  IceInternal::TcpAcceptor::accept()
142
141
  {
143
- return make_shared<TcpTransceiver>(_instance, make_shared<StreamSocket>(_instance, doAccept(_fd)));
142
+ return make_shared<TcpTransceiver>(_instance, make_shared<StreamSocket>(_instance, doAccept(_fd), _bufSize));
144
143
  }
145
144
 
146
145
  # endif
@@ -178,7 +177,8 @@ IceInternal::TcpAcceptor::TcpAcceptor(
178
177
  int port)
179
178
  : _endpoint(std::move(endpoint)),
180
179
  _instance(instance),
181
- _addr(getAddressForServer(host, port, _instance->protocolSupport(), instance->preferIPv6(), true))
180
+ _addr(getAddressForServer(host, port, _instance->protocolSupport(), instance->preferIPv6(), true)),
181
+ _bufSize(instance->properties())
182
182
  # ifdef ICE_USE_IOCP
183
183
  ,
184
184
  _acceptFd(INVALID_SOCKET),
@@ -193,7 +193,7 @@ IceInternal::TcpAcceptor::TcpAcceptor(
193
193
  # endif
194
194
 
195
195
  setBlock(_fd, false);
196
- setTcpBufSize(_fd, _instance);
196
+ setTcpBufSize(_fd, _bufSize.rcvSize(), _bufSize.sndSize(), _instance);
197
197
 
198
198
  # ifndef _WIN32
199
199
  // Set SO_REUSEADDR socket option on Unix platforms to allow re-using the address even if the socket remains in
@@ -6,11 +6,11 @@
6
6
  #include "Acceptor.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
12
13
  {
13
- class TcpEndpoint;
14
14
 
15
15
  class TcpAcceptor final : public Acceptor, public NativeInfo, public std::enable_shared_from_this<TcpAcceptor>
16
16
  {
@@ -42,6 +42,7 @@ namespace IceInternal
42
42
  TcpEndpointIPtr _endpoint;
43
43
  const ProtocolInstancePtr _instance;
44
44
  const Address _addr;
45
+ const TcpBufSize _bufSize;
45
46
 
46
47
  int _backlog;
47
48
  #if defined(ICE_USE_IOCP)