zeroc-ice 3.8.1 → 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 (280) 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 +29 -11
  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 +26 -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 +14 -11
  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 +57 -23
  54. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
  55. data/dist/ice/cpp/include/generated/Ice/Metrics.h +99 -44
  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 +8 -4
  62. data/dist/ice/cpp/include/generated/Ice/Router.h +55 -19
  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 +6 -4
  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 +121 -108
  82. data/dist/ice/cpp/src/Ice/ConnectionI.h +12 -9
  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 +15 -79
  87. data/dist/ice/cpp/src/Ice/FileUtil.h +0 -3
  88. data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
  89. data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
  90. data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
  91. data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +4 -0
  92. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
  93. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +2 -4
  94. data/dist/ice/cpp/src/Ice/InputStream.cpp +50 -33
  95. data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
  96. data/dist/ice/cpp/src/Ice/Instance.h +1 -6
  97. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +7 -1
  98. data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
  99. data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
  100. data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
  101. data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
  102. data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
  103. data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
  104. data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
  105. data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
  106. data/dist/ice/cpp/src/Ice/Network.h +12 -7
  107. data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
  108. data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
  109. data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
  110. data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
  111. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
  112. data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
  113. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +2 -2
  114. data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +127 -127
  115. data/dist/ice/cpp/src/Ice/OutgoingResponseInternal.h +21 -0
  116. data/dist/ice/cpp/src/Ice/OutputStream.cpp +50 -65
  117. data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
  118. data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
  119. data/dist/ice/cpp/src/Ice/PropertyNames.cpp +2 -1
  120. data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
  121. data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
  122. data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
  123. data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
  124. data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
  125. data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +4 -4
  126. data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
  127. data/dist/ice/cpp/src/Ice/Random.h +6 -2
  128. data/dist/ice/cpp/src/Ice/Reference.cpp +37 -26
  129. data/dist/ice/cpp/src/Ice/Reference.h +3 -0
  130. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +26 -13
  131. data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
  132. data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
  133. data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
  134. data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
  135. data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
  136. data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
  137. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
  138. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
  139. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +27 -12
  140. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +1 -2
  141. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
  142. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
  143. data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
  144. data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +1 -1
  145. data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +1 -4
  146. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
  147. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +165 -80
  148. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +1 -5
  149. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +73 -33
  150. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
  151. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +110 -17
  152. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +7 -2
  153. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
  154. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
  155. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
  156. data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
  157. data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
  158. data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
  159. data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
  160. data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
  161. data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
  162. data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
  163. data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
  164. data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
  165. data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
  166. data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
  167. data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
  168. data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
  169. data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
  170. data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
  171. data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +2 -2
  172. data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
  173. data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
  174. data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
  175. data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
  176. data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
  177. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +6 -3
  178. data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
  179. data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
  180. data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +8 -3
  181. data/dist/ice/cpp/src/Ice/WSAcceptor.h +5 -1
  182. data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +45 -2
  183. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +214 -34
  184. data/dist/ice/cpp/src/Ice/WSTransceiver.h +13 -2
  185. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
  186. data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
  187. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
  188. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
  189. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
  190. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
  191. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
  192. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
  193. data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
  194. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
  195. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
  196. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
  197. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +4 -2
  198. data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
  199. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
  200. data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
  201. data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
  202. data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
  203. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
  204. data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
  205. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
  206. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +32 -26
  207. data/dist/ice/cpp/src/Slice/DocCommentParser.h +6 -4
  208. data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
  209. data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
  210. data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
  211. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +34 -14
  212. data/dist/ice/cpp/src/Slice/MetadataValidation.h +3 -2
  213. data/dist/ice/cpp/src/Slice/Parser.cpp +145 -97
  214. data/dist/ice/cpp/src/Slice/Parser.h +22 -8
  215. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +77 -29
  216. data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -3
  217. data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
  218. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +203 -172
  219. data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
  220. data/dist/ice/cpp/src/Slice/Util.h +21 -12
  221. data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
  222. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +26 -20
  223. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +10 -13
  224. data/dist/ice/slice/Glacier2/Router.ice +3 -3
  225. data/dist/ice/slice/Ice/Identity.ice +3 -0
  226. data/dist/ice/slice/Ice/Locator.ice +6 -5
  227. data/dist/ice/slice/Ice/LocatorRegistry.ice +3 -0
  228. data/dist/ice/slice/Ice/Metrics.ice +7 -6
  229. data/dist/ice/slice/Ice/OperationMode.ice +8 -0
  230. data/dist/ice/slice/Ice/Process.ice +3 -0
  231. data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
  232. data/dist/ice/slice/Ice/ReplyStatus.ice +13 -0
  233. data/dist/ice/slice/IceGrid/Admin.ice +9 -9
  234. data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
  235. data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
  236. data/dist/lib/Glacier2/Metrics.rb +1 -1
  237. data/dist/lib/Glacier2/PermissionsVerifier.rb +3 -3
  238. data/dist/lib/Glacier2/Router.rb +9 -9
  239. data/dist/lib/Glacier2/SSLInfo.rb +1 -1
  240. data/dist/lib/Glacier2/Session.rb +15 -15
  241. data/dist/lib/Ice/BuiltinSequences.rb +1 -1
  242. data/dist/lib/Ice/CompressBatch.rb +1 -2
  243. data/dist/lib/Ice/Context.rb +1 -1
  244. data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
  245. data/dist/lib/Ice/EndpointTypes.rb +1 -1
  246. data/dist/lib/Ice/Identity.rb +1 -1
  247. data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
  248. data/dist/lib/Ice/LocalExceptions.rb +3 -0
  249. data/dist/lib/Ice/Locator.rb +5 -5
  250. data/dist/lib/Ice/LocatorRegistry.rb +4 -4
  251. data/dist/lib/Ice/Metrics.rb +7 -7
  252. data/dist/lib/Ice/OperationMode.rb +2 -3
  253. data/dist/lib/Ice/Process.rb +3 -3
  254. data/dist/lib/Ice/PropertiesAdmin.rb +4 -4
  255. data/dist/lib/Ice/PropertyDict.rb +1 -1
  256. data/dist/lib/Ice/ProxyFunctions.rb +8 -4
  257. data/dist/lib/Ice/RemoteLogger.rb +7 -8
  258. data/dist/lib/Ice/ReplyStatus.rb +4 -4
  259. data/dist/lib/Ice/Router.rb +5 -5
  260. data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
  261. data/dist/lib/Ice/SliceUtil.rb +2 -2
  262. data/dist/lib/Ice/Struct.rb +1 -0
  263. data/dist/lib/Ice/ToStringMode.rb +1 -2
  264. data/dist/lib/Ice/Value.rb +2 -2
  265. data/dist/lib/Ice/Version.rb +1 -1
  266. data/dist/lib/IceBox/ServiceManager.rb +8 -8
  267. data/dist/lib/IceGrid/Admin.rb +85 -86
  268. data/dist/lib/IceGrid/Descriptor.rb +1 -1
  269. data/dist/lib/IceGrid/Exception.rb +1 -1
  270. data/dist/lib/IceGrid/FileParser.rb +2 -2
  271. data/dist/lib/IceGrid/Registry.rb +14 -15
  272. data/dist/lib/IceGrid/Session.rb +7 -7
  273. data/dist/lib/IceGrid/UserAccountMapper.rb +2 -2
  274. data/dist/lib/IceStorm/IceStorm.rb +16 -16
  275. data/dist/lib/IceStorm/Metrics.rb +1 -1
  276. data/extconf.rb +1 -1
  277. data/ice.gemspec +3 -3
  278. metadata +5 -5
  279. data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
  280. data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
@@ -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
 
@@ -56,7 +56,7 @@ IceInternal::WSAcceptor::accept()
56
56
  // WebSocket handshaking is performed in TransceiverI::initialize, since
57
57
  // accept must not block.
58
58
  //
59
- return make_shared<WSTransceiver>(_instance, _delegate->accept());
59
+ return make_shared<WSTransceiver>(_instance, _delegate->accept(), _allowedOrigins);
60
60
  }
61
61
 
62
62
  string
@@ -77,10 +77,15 @@ IceInternal::WSAcceptor::toDetailedString() const
77
77
  return _delegate->toDetailedString();
78
78
  }
79
79
 
80
- IceInternal::WSAcceptor::WSAcceptor(WSEndpointPtr endpoint, ProtocolInstancePtr instance, AcceptorPtr del)
80
+ IceInternal::WSAcceptor::WSAcceptor(
81
+ WSEndpointPtr endpoint,
82
+ ProtocolInstancePtr instance,
83
+ AcceptorPtr del,
84
+ set<string> allowedOrigins)
81
85
  : _endpoint(std::move(endpoint)),
82
86
  _instance(std::move(instance)),
83
- _delegate(std::move(del))
87
+ _delegate(std::move(del)),
88
+ _allowedOrigins(std::move(allowedOrigins))
84
89
  {
85
90
  }
86
91
 
@@ -9,6 +9,9 @@
9
9
  #include "ProtocolInstance.h"
10
10
  #include "TransceiverF.h"
11
11
 
12
+ #include <set>
13
+ #include <string>
14
+
12
15
  namespace IceInternal
13
16
  {
14
17
  class WSEndpoint;
@@ -16,7 +19,7 @@ namespace IceInternal
16
19
  class WSAcceptor final : public Acceptor, public NativeInfo
17
20
  {
18
21
  public:
19
- WSAcceptor(WSEndpointPtr, ProtocolInstancePtr, AcceptorPtr);
22
+ WSAcceptor(WSEndpointPtr, ProtocolInstancePtr, AcceptorPtr, std::set<std::string> allowedOrigins);
20
23
  ~WSAcceptor() override;
21
24
  NativeInfoPtr getNativeInfo() final;
22
25
  #if defined(ICE_USE_IOCP)
@@ -40,6 +43,7 @@ namespace IceInternal
40
43
  WSEndpointPtr _endpoint;
41
44
  const ProtocolInstancePtr _instance;
42
45
  const AcceptorPtr _delegate;
46
+ const std::set<std::string> _allowedOrigins;
43
47
  };
44
48
  }
45
49
 
@@ -10,6 +10,7 @@
10
10
  #include "TargetCompare.h"
11
11
  #include "WSAcceptor.h"
12
12
  #include "WSConnector.h"
13
+ #include "WSTransceiver.h"
13
14
 
14
15
  #include <algorithm>
15
16
 
@@ -21,6 +22,36 @@ namespace
21
22
  {
22
23
  const char* const wsPluginName = "IceWS";
23
24
 
25
+ // Parse the values of the ObjectAdapter property "AllowedOrigins" into a canonicalized set of origins.
26
+ // Each entry is "scheme://host[:port]", lowercased, with the default port for the scheme (80/443) omitted.
27
+ // The literal "*" disables enforcement; in that case the returned set is empty -- handleRequest treats an empty
28
+ // allowlist as "allow any origin", so the two cases (unset and wildcard) collapse into one.
29
+ // Throws PropertyException if any entry is not a syntactically valid origin; propertyName is included in the
30
+ // message so the operator can identify which adapter is misconfigured.
31
+ set<string> parseAllowedOrigins(const vector<string>& entries, const string& propertyName)
32
+ {
33
+ set<string> result;
34
+ for (const auto& entry : entries)
35
+ {
36
+ if (entry == "*")
37
+ {
38
+ return {};
39
+ }
40
+ try
41
+ {
42
+ result.insert(canonicalizeOrigin(entry));
43
+ }
44
+ catch (const std::invalid_argument&)
45
+ {
46
+ throw PropertyException(
47
+ __FILE__,
48
+ __LINE__,
49
+ "malformed origin '" + entry + "' in property '" + propertyName + "'");
50
+ }
51
+ }
52
+ return result;
53
+ }
54
+
24
55
  class WSEndpointFactoryPlugin : public Plugin
25
56
  {
26
57
  public:
@@ -246,8 +277,20 @@ IceInternal::WSEndpoint::acceptor(
246
277
  const string& adapterName,
247
278
  const optional<Ice::SSL::ServerAuthenticationOptions>& serverAuthenticationOptions) const
248
279
  {
280
+ // Parse AllowedOrigins before creating the delegate acceptor so a malformed property doesn't leave an open socket
281
+ // hanging on a TcpAcceptor whose destructor asserts INVALID_SOCKET.
282
+ set<string> allowedOrigins;
283
+ if (!adapterName.empty())
284
+ {
285
+ const string propertyName = adapterName + ".AllowedOrigins";
286
+ allowedOrigins = parseAllowedOrigins(_instance->properties()->getPropertyAsList(propertyName), propertyName);
287
+ }
249
288
  AcceptorPtr acceptor = _delegate->acceptor(adapterName, serverAuthenticationOptions);
250
- return make_shared<WSAcceptor>(const_cast<WSEndpoint*>(this)->shared_from_this(), _instance, acceptor);
289
+ return make_shared<WSAcceptor>(
290
+ const_cast<WSEndpoint*>(this)->shared_from_this(),
291
+ _instance,
292
+ acceptor,
293
+ std::move(allowedOrigins));
251
294
  }
252
295
 
253
296
  WSEndpointPtr
@@ -255,7 +298,7 @@ IceInternal::WSEndpoint::endpoint(const EndpointIPtr& delEndp) const
255
298
  {
256
299
  if (delEndp.get() == _delegate.get())
257
300
  {
258
- return dynamic_pointer_cast<WSEndpoint>(const_cast<WSEndpoint*>(this)->shared_from_this());
301
+ return static_pointer_cast<WSEndpoint>(const_cast<WSEndpoint*>(this)->shared_from_this());
259
302
  }
260
303
  else
261
304
  {