passenger 6.2.0 → 6.2.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG +33 -1
- data/CONTRIBUTING.md +7 -311
- data/CONTRIBUTORS +1 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/passenger +1 -1
- data/bin/passenger-config +1 -1
- data/bin/passenger-install-apache2-module +1 -1
- data/bin/passenger-install-nginx-module +4 -9
- data/bin/passenger-memory-stats +1 -1
- data/bin/passenger-status +1 -1
- data/build/agent.rb +13 -15
- data/build/apache2.rb +13 -16
- data/build/basics.rb +10 -13
- data/build/common_library.rb +5 -9
- data/build/cxx_tests.rb +37 -12
- data/build/integration_tests.rb +5 -2
- data/build/misc.rb +1 -1
- data/build/nginx.rb +1 -1
- data/build/node_tests.rb +1 -1
- data/build/oxt_tests.rb +6 -8
- data/build/packaging.rb +1 -1
- data/build/ruby_extension.rb +1 -1
- data/build/ruby_tests.rb +1 -1
- data/build/schema_printer.rb +13 -15
- data/build/support/cplusplus.rb +61 -69
- data/build/support/cxx_dependency_map.rb +2 -1
- data/build/support/general.rb +1 -1
- data/build/support/vendor/cxx_hinted_parser/LICENSE.md +1 -1
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +1 -1
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/LICENSE.md +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb +1 -1
- data/build/test_basics.rb +1 -1
- data/dev/copy_boost_headers +1 -1
- data/dev/index_cxx_dependencies.rb +5 -1
- data/dev/libev-changes.patch +108 -0
- data/dev/nginx_version_sha256 +1 -1
- data/dev/ruby_server.rb +1 -6
- data/dev/upgrading_libuv.sh +16 -0
- data/doc/BasicArchitectureOverview.md +55 -0
- data/doc/BuildCaching.md +23 -0
- data/doc/BuildSystem.md +49 -0
- data/doc/DebuggingAndStressTesting.md +2 -0
- data/doc/DesignAspects/LimitedGemDependencies.md +1 -0
- data/doc/DevEnvironmentSetup.md +46 -0
- data/doc/DevHandbook.md +28 -0
- data/doc/Packaging.md +1 -1
- data/doc/RunningTests.md +88 -0
- data/doc/{TempFileHandling.md → SecureTempFileHandling.md} +1 -1
- data/doc/{CxxTestingGuide.md → WritingCxxTests.md} +1 -20
- data/src/agent/AgentMain.cpp +1 -1
- data/src/agent/Core/ApiServer.h +1 -1
- data/src/agent/Core/ApplicationPool/AbstractSession.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/Common.h +1 -1
- data/src/agent/Core/ApplicationPool/Context.h +1 -1
- data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SessionManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/Verification.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group.h +1 -1
- data/src/agent/Core/ApplicationPool/Implementation.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Options.h +1 -1
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GarbageCollection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/ProcessUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool.h +1 -1
- data/src/agent/Core/ApplicationPool/Process.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Process.h +1 -1
- data/src/agent/Core/ApplicationPool/Session.h +1 -1
- data/src/agent/Core/ApplicationPool/Socket.h +1 -1
- data/src/agent/Core/ApplicationPool/TestSession.h +1 -1
- data/src/agent/Core/Config.h +3 -2
- data/src/agent/Core/ConfigChange.cpp +1 -1
- data/src/agent/Core/ConfigChange.h +1 -1
- data/src/agent/Core/Controller/AppResponse.h +1 -1
- data/src/agent/Core/Controller/BufferBody.cpp +1 -1
- data/src/agent/Core/Controller/CheckoutSession.cpp +8 -5
- data/src/agent/Core/Controller/Client.h +1 -1
- data/src/agent/Core/Controller/Config.cpp +1 -1
- data/src/agent/Core/Controller/Config.h +2 -2
- data/src/agent/Core/Controller/ForwardResponse.cpp +2 -2
- data/src/agent/Core/Controller/Hooks.cpp +12 -9
- data/src/agent/Core/Controller/Implementation.cpp +1 -1
- data/src/agent/Core/Controller/InitRequest.cpp +1 -1
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/Controller/InternalUtils.cpp +1 -1
- data/src/agent/Core/Controller/Miscellaneous.cpp +1 -1
- data/src/agent/Core/Controller/Request.h +1 -1
- data/src/agent/Core/Controller/SendRequest.cpp +1 -1
- data/src/agent/Core/Controller/StateInspection.cpp +1 -1
- data/src/agent/Core/Controller/TurboCaching.h +1 -1
- data/src/agent/Core/Controller.h +1 -1
- data/src/agent/Core/CoreMain.cpp +1 -1
- data/src/agent/Core/OptionParser.h +1 -1
- data/src/agent/Core/ResponseCache.h +1 -1
- data/src/agent/Core/SecurityUpdateChecker.h +1 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +1 -1
- data/src/agent/Core/SpawningKit/Config.h +1 -1
- data/src/agent/Core/SpawningKit/Context.h +1 -1
- data/src/agent/Core/SpawningKit/DirectSpawner.h +1 -1
- data/src/agent/Core/SpawningKit/DummySpawner.h +1 -1
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +63 -2
- data/src/agent/Core/SpawningKit/Factory.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +3 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Session.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +1 -1
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/README.md +3 -3
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +1 -1
- data/src/agent/Core/SpawningKit/Result.h +1 -1
- data/src/agent/Core/SpawningKit/SmartSpawner.h +17 -17
- data/src/agent/Core/SpawningKit/Spawner.h +1 -1
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +1 -1
- data/src/agent/Core/TelemetryCollector.h +1 -1
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/FileReadHelper/FileReadHelperMain.cpp +1 -1
- data/src/agent/MainFunctions.h +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +4 -3
- data/src/agent/Shared/ApiServerUtils.h +1 -2
- data/src/agent/Shared/ApplicationPoolApiKey.h +1 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.h +1 -1
- data/src/agent/Shared/Fundamentals/Initialization.cpp +1 -1
- data/src/agent/Shared/Fundamentals/Initialization.h +1 -1
- data/src/agent/Shared/Fundamentals/Utils.cpp +1 -1
- data/src/agent/Shared/Fundamentals/Utils.h +1 -1
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +1 -1
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
- data/src/agent/Watchdog/ApiServer.h +7 -6
- data/src/agent/Watchdog/Config.h +2 -2
- data/src/apache2_module/Bucket.cpp +1 -1
- data/src/apache2_module/Bucket.h +1 -1
- data/src/apache2_module/CBindings.cpp +1 -1
- data/src/apache2_module/Config.cpp +1 -1
- data/src/apache2_module/Config.h +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +104 -104
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +2 -2
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ConfigGeneral/Common.h +1 -1
- data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +1 -1
- data/src/apache2_module/ConfigGeneral/SetterFuncs.h +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/apache2_module/DirectoryMapper.h +1 -1
- data/src/apache2_module/Hooks.cpp +8 -2
- data/src/apache2_module/Hooks.h +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/apache2_module/Utils.h +1 -1
- data/src/apache2_module/mod_passenger.c +1 -1
- data/src/cxx_supportlib/Algorithms/Hasher.cpp +1 -1
- data/src/cxx_supportlib/Algorithms/Hasher.h +1 -1
- data/src/cxx_supportlib/Algorithms/MovingAverage.h +1 -1
- data/src/cxx_supportlib/AppLocalConfigFileUtils.h +1 -1
- data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +1 -1
- data/src/cxx_supportlib/AppTypeDetector/CBindings.h +1 -1
- data/src/cxx_supportlib/AppTypeDetector/Detector.h +1 -1
- data/src/cxx_supportlib/BackgroundEventLoop.cpp +1 -1
- data/src/cxx_supportlib/BackgroundEventLoop.h +1 -1
- data/src/cxx_supportlib/ConfigKit/AsyncUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Common.h +1 -1
- data/src/cxx_supportlib/ConfigKit/ConfigKit.h +1 -1
- data/src/cxx_supportlib/ConfigKit/DummyTranslator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +1 -3
- data/src/cxx_supportlib/ConfigKit/PrefixTranslator.h +3 -3
- data/src/cxx_supportlib/ConfigKit/Schema.h +1 -1
- data/src/cxx_supportlib/ConfigKit/SchemaUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Store.h +1 -1
- data/src/cxx_supportlib/ConfigKit/SubComponentUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/TableTranslator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Translator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Utils.h +1 -1
- data/src/cxx_supportlib/Constants.h +2 -2
- data/src/cxx_supportlib/Constants.h.cxxcodebuilder +1 -1
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +1 -1
- data/src/cxx_supportlib/DataStructures/LString.cpp +1 -1
- data/src/cxx_supportlib/DataStructures/LString.h +1 -1
- data/src/cxx_supportlib/DataStructures/StringKeyTable.h +1 -1
- data/src/cxx_supportlib/DataStructures/StringMap.h +1 -1
- data/src/cxx_supportlib/Exceptions.cpp +1 -1
- data/src/cxx_supportlib/Exceptions.h +1 -1
- data/src/cxx_supportlib/FileDescriptor.h +1 -1
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/FileManip.h +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.h +1 -1
- data/src/cxx_supportlib/FileTools/PathManipCBindings.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManipCBindings.h +1 -1
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.h +1 -1
- data/src/cxx_supportlib/Hooks.h +1 -1
- data/src/cxx_supportlib/IOTools/BufferedIO.h +1 -1
- data/src/cxx_supportlib/IOTools/IOUtils.cpp +10 -10
- data/src/cxx_supportlib/IOTools/IOUtils.h +1 -1
- data/src/cxx_supportlib/IOTools/MessageIO.h +1 -1
- data/src/cxx_supportlib/IOTools/MessageSerialization.h +1 -1
- data/src/cxx_supportlib/InstanceDirectory.h +1 -1
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +1 -1
- data/src/cxx_supportlib/JsonTools/Autocast.h +1 -1
- data/src/cxx_supportlib/JsonTools/CBindings.cpp +1 -1
- data/src/cxx_supportlib/JsonTools/CBindings.h +1 -1
- data/src/cxx_supportlib/JsonTools/JsonUtils.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Assert.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Config.h +2 -1
- data/src/cxx_supportlib/LoggingKit/Context.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Forward.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +11 -1
- data/src/cxx_supportlib/LoggingKit/Logging.h +1 -1
- data/src/cxx_supportlib/LoggingKit/LoggingKit.h +1 -1
- data/src/cxx_supportlib/LveLoggingDecorator.h +1 -1
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +1 -1
- data/src/cxx_supportlib/MemoryKit/mbuf.h +1 -1
- data/src/cxx_supportlib/MemoryKit/palloc.cpp +1 -1
- data/src/cxx_supportlib/MemoryKit/palloc.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Ruby.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Utils.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Utils.h +1 -1
- data/src/cxx_supportlib/RandomGenerator.h +1 -1
- data/src/cxx_supportlib/ResourceLocator.h +1 -1
- data/src/cxx_supportlib/SafeLibev.h +1 -1
- data/src/cxx_supportlib/SecurityKit/Crypto.cpp +9 -27
- data/src/cxx_supportlib/SecurityKit/Crypto.h +2 -2
- data/src/cxx_supportlib/SecurityKit/MemZeroGuard.h +1 -1
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +1 -1
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/Client.h +1 -1
- data/src/cxx_supportlib/ServerKit/ClientRef.h +1 -1
- data/src/cxx_supportlib/ServerKit/Config.h +1 -1
- data/src/cxx_supportlib/ServerKit/Context.h +1 -1
- data/src/cxx_supportlib/ServerKit/CookieUtils.h +1 -1
- data/src/cxx_supportlib/ServerKit/Errors.h +1 -1
- data/src/cxx_supportlib/ServerKit/FdSinkChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/FdSourceChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +54 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HeaderTable.h +1 -1
- data/src/cxx_supportlib/ServerKit/Hooks.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParserState.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpClient.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpRequest.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpServer.h +1 -1
- data/src/cxx_supportlib/ServerKit/Implementation.cpp +1 -1
- data/src/cxx_supportlib/ServerKit/Server.h +4 -2
- data/src/cxx_supportlib/StaticString.h +1 -1
- data/src/cxx_supportlib/StrIntTools/DateParsing.h +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtils.cpp +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtils.h +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtilsNoStrictAliasing.cpp +1 -1
- data/src/cxx_supportlib/StrIntTools/StringScanning.h +1 -1
- data/src/cxx_supportlib/StrIntTools/Template.h +1 -1
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +1 -1
- data/src/cxx_supportlib/SystemTools/ProcessMetricsCollector.h +1 -1
- data/src/cxx_supportlib/SystemTools/SystemMetricsCollector.h +1 -1
- data/src/cxx_supportlib/SystemTools/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/SystemTools/SystemTime.h +1 -1
- data/src/cxx_supportlib/SystemTools/UserDatabase.cpp +1 -1
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils/AnsiColorConstants.h +1 -1
- data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +1 -1
- data/src/cxx_supportlib/Utils/BlockingQueue.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.cpp +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +1 -1
- data/src/cxx_supportlib/Utils/ClassUtils.h +1 -1
- data/src/cxx_supportlib/Utils/Curl.h +1 -1
- data/src/cxx_supportlib/Utils/FastStringStream.h +1 -1
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +1 -1
- data/src/cxx_supportlib/Utils/HttpConstants.h +1 -1
- data/src/cxx_supportlib/Utils/IniFile.h +1 -1
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/OptionParsing.h +1 -1
- data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +1 -1
- data/src/cxx_supportlib/Utils/ScopeGuard.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +1 -1
- data/src/cxx_supportlib/Utils/Timer.h +1 -1
- data/src/cxx_supportlib/Utils/VariantMap.h +1 -1
- data/src/cxx_supportlib/Utils.cpp +1 -1
- data/src/cxx_supportlib/Utils.h +1 -1
- data/src/cxx_supportlib/WatchdogLauncher.cpp +1 -1
- data/src/cxx_supportlib/WatchdogLauncher.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Entry.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +1 -1
- data/src/cxx_supportlib/oxt/backtrace.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/backtrace_disabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/backtrace_enabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/context.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/tracable_exception_disabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/tracable_exception_enabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +1 -1
- data/src/cxx_supportlib/oxt/implementation.cpp +1 -1
- data/src/cxx_supportlib/oxt/initialize.hpp +1 -1
- data/src/cxx_supportlib/oxt/macros.hpp +1 -1
- data/src/cxx_supportlib/oxt/spin_lock.hpp +1 -1
- data/src/cxx_supportlib/oxt/system_calls.cpp +1 -1
- data/src/cxx_supportlib/oxt/system_calls.hpp +1 -1
- data/src/cxx_supportlib/oxt/thread.hpp +1 -1
- data/src/cxx_supportlib/oxt/tracable_exception.hpp +1 -1
- data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/AUTHORS +353 -3
- data/src/cxx_supportlib/vendor-copy/libuv/ChangeLog +3981 -2
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE +1 -28
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-docs +396 -0
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-extra +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.am +275 -58
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.in +4380 -2125
- data/src/cxx_supportlib/vendor-copy/libuv/aclocal.m4 +425 -221
- data/src/cxx_supportlib/vendor-copy/libuv/ar-lib +30 -10
- data/src/cxx_supportlib/vendor-copy/libuv/compile +31 -14
- data/src/cxx_supportlib/vendor-copy/libuv/config.guess +1084 -690
- data/src/cxx_supportlib/vendor-copy/libuv/config.sub +1844 -1297
- data/src/cxx_supportlib/vendor-copy/libuv/configure +6935 -3664
- data/src/cxx_supportlib/vendor-copy/libuv/configure.ac +43 -19
- data/src/cxx_supportlib/vendor-copy/libuv/depcomp +12 -11
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-darwin.h → uv/darwin.h} +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-errno.h → uv/errno.h} +119 -60
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-linux.h → uv/linux.h} +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/os390.h +33 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/posix.h +31 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-threadpool.h → uv/threadpool.h} +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/{tree.h → uv/tree.h} +3 -250
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-unix.h → uv/unix.h} +186 -60
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-version.h → uv/version.h} +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/win.h +703 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv.h +528 -40
- data/src/cxx_supportlib/vendor-copy/libuv/install-sh +110 -70
- data/src/cxx_supportlib/vendor-copy/libuv/libuv-static.pc.in +12 -0
- data/src/cxx_supportlib/vendor-copy/libuv/libuv.pc.in +4 -2
- data/src/cxx_supportlib/vendor-copy/libuv/ltmain.sh +995 -619
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ax_pthread.m4 +485 -0
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libtool.m4 +438 -289
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-flags.m4 +21 -4
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-versions.m4 +7 -0
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltoptions.m4 +69 -39
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltsugar.m4 +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltversion.m4 +7 -6
- data/src/cxx_supportlib/vendor-copy/libuv/m4/lt~obsolete.m4 +2 -2
- data/src/cxx_supportlib/vendor-copy/libuv/missing +55 -34
- data/src/cxx_supportlib/vendor-copy/libuv/src/fs-poll.c +52 -20
- data/src/cxx_supportlib/vendor-copy/libuv/src/idna.c +560 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/idna.h +31 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/inet.c +5 -16
- data/src/cxx_supportlib/vendor-copy/libuv/src/queue.h +68 -86
- data/src/cxx_supportlib/vendor-copy/libuv/src/random.c +123 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.c +38 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.h +39 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.c +52 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.h +27 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/thread-common.c +175 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/threadpool.c +172 -57
- data/src/cxx_supportlib/vendor-copy/libuv/src/{unix/timer.c → timer.c} +57 -29
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix-common.c +89 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix.c +418 -256
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/async.c +168 -129
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-ifaddrs.c +163 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-proctitle.c +99 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/core.c +1312 -378
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/cygwin.c +93 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-proctitle.c +18 -32
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-stub.h +97 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-syscalls.h +17 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin.c +41 -139
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/dl.c +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/freebsd.c +75 -235
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fs.c +1308 -299
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fsevents.c +150 -148
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getaddrinfo.c +58 -8
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getnameinfo.c +3 -2
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/haiku.c +172 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/hurd.c +172 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/ibmi.c +542 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/internal.h +297 -106
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/kqueue.c +325 -94
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux.c +2708 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop-watcher.c +11 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop.c +105 -24
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/netbsd.c +51 -157
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-fsevents.c +42 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-proctitle.c +45 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/openbsd.c +42 -183
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-proctitle.c +136 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.c +536 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.h +75 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390.c +1070 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pipe.c +324 -55
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/poll.c +58 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-hrtime.c +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-poll.c +385 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/process.c +795 -248
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/procfs-exepath.c +45 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/proctitle.c +77 -22
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/qnx.c +142 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-devurandom.c +93 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getentropy.c +57 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getrandom.c +86 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-sysctl-linux.c +99 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/signal.c +147 -39
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/stream.c +426 -474
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sunos.c +240 -98
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-loadavg.c +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-memory.c +42 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tcp.c +402 -91
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/thread.c +497 -145
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tty.c +269 -45
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/udp.c +695 -165
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.c +463 -61
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.h +248 -44
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-data-getter-setters.c +119 -0
- data/src/cxx_supportlib/vendor-copy/libuv/tsansupp.txt +2 -0
- data/src/cxx_supportlib/vendor-modified/libev/Changes +109 -0
- data/src/cxx_supportlib/vendor-modified/libev/Makefile.am +2 -1
- data/src/cxx_supportlib/vendor-modified/libev/Makefile.in +47 -33
- data/src/cxx_supportlib/vendor-modified/libev/README +2 -1
- data/src/cxx_supportlib/vendor-modified/libev/aclocal.m4 +1653 -1224
- data/src/cxx_supportlib/vendor-modified/libev/config.guess +376 -316
- data/src/cxx_supportlib/vendor-modified/libev/config.h.in +13 -2
- data/src/cxx_supportlib/vendor-modified/libev/config.sub +156 -154
- data/src/cxx_supportlib/vendor-modified/libev/configure +1431 -940
- data/src/cxx_supportlib/vendor-modified/libev/configure.ac +3 -3
- data/src/cxx_supportlib/vendor-modified/libev/depcomp +5 -5
- data/src/cxx_supportlib/vendor-modified/libev/ev++.h +109 -107
- data/src/cxx_supportlib/vendor-modified/libev/ev.c +807 -319
- data/src/cxx_supportlib/vendor-modified/libev/ev.h +111 -105
- data/src/cxx_supportlib/vendor-modified/libev/ev_epoll.c +42 -29
- data/src/cxx_supportlib/vendor-modified/libev/ev_iouring.c +694 -0
- data/src/cxx_supportlib/vendor-modified/libev/ev_kqueue.c +15 -9
- data/src/cxx_supportlib/vendor-modified/libev/ev_linuxaio.c +620 -0
- data/src/cxx_supportlib/vendor-modified/libev/ev_poll.c +19 -14
- data/src/cxx_supportlib/vendor-modified/libev/ev_port.c +8 -5
- data/src/cxx_supportlib/vendor-modified/libev/ev_select.c +6 -6
- data/src/cxx_supportlib/vendor-modified/libev/ev_vars.h +48 -3
- data/src/cxx_supportlib/vendor-modified/libev/ev_win32.c +2 -2
- data/src/cxx_supportlib/vendor-modified/libev/ev_wrap.h +72 -0
- data/src/cxx_supportlib/vendor-modified/libev/install-sh +23 -13
- data/src/cxx_supportlib/vendor-modified/libev/libev.m4 +6 -1
- data/src/cxx_supportlib/vendor-modified/libev/ltmain.sh +3581 -1993
- data/src/cxx_supportlib/vendor-modified/libev/missing +8 -8
- data/src/cxx_supportlib/vendor-modified/libev/mkinstalldirs +3 -3
- data/src/cxx_supportlib/vendor-modified/modp_b64_strict_aliasing.cpp +1 -1
- data/src/helper-scripts/backtrace-sanitizer.rb +1 -1
- data/src/helper-scripts/crash-watch.rb +1 -1
- data/src/helper-scripts/download_binaries/extconf.rb +1 -1
- data/src/helper-scripts/meteor-loader.rb +1 -1
- data/src/helper-scripts/node-loader.js +1 -1
- data/src/helper-scripts/prespawn +1 -1
- data/src/helper-scripts/rack-loader.rb +1 -1
- data/src/helper-scripts/rack-preloader.rb +1 -1
- data/src/helper-scripts/wsgi-loader.py +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c.cxxcodebuilder +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c.cxxcodebuilder +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c.cxxcodebuilder +1 -1
- data/src/nginx_module/Configuration.c +1 -1
- data/src/nginx_module/Configuration.h +1 -1
- data/src/nginx_module/ContentHandler.c +1 -1
- data/src/nginx_module/ContentHandler.h +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/nginx_module/StaticContentHandler.c +1 -1
- data/src/nginx_module/StaticContentHandler.h +1 -1
- data/src/nginx_module/ngx_http_passenger_module.c +1 -1
- data/src/nginx_module/ngx_http_passenger_module.h +1 -1
- data/src/nodejs_supportlib/phusion_passenger/line_reader.js +1 -1
- data/src/ruby_native_extension/extconf.rb +1 -1
- data/src/ruby_native_extension/passenger_native_support.c +1 -1
- data/src/ruby_supportlib/phusion_passenger/abstract_installer.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +2 -12
- data/src/ruby_supportlib/phusion_passenger/admin_tools.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +8 -10
- data/src/ruby_supportlib/phusion_passenger/config/about_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/build_native_support_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/compile_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/compile_nginx_engine_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/detach_process_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/installation_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/main.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +3 -2
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +6 -1
- data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/system_metrics_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/system_properties_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_client.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +4 -3
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +195 -11
- data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/curl.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/linux.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/networking.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/openssl.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/pcre.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/plugin.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/out_of_band_gc.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +2 -7
- data/src/ruby_supportlib/phusion_passenger/request_handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_io_enhancements.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/simple_benchmarking.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/control_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/main.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +4 -8
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/ansi_colors.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/download.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/lock.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/native_support_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/progress_bar.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/terminal_choice_menu.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/unseekable_socket.rb +3 -13
- data/src/ruby_supportlib/phusion_passenger/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +8 -6
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/spawn.rb +4 -3
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +6 -4
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +395 -579
- data/src/ruby_supportlib/phusion_passenger.rb +8 -8
- data/src/schema_printer/SchemaPrinterMain.cpp +1 -1
- data/src/schema_printer/SchemaPrinterMain.cpp.cxxcodebuilder +1 -1
- metadata +69 -32
- data/doc/DeveloperQuickstart.md +0 -70
- data/src/README.md +0 -7
- data/src/cxx_supportlib/vendor-copy/libuv/README.md +0 -245
- data/src/cxx_supportlib/vendor-copy/libuv/checksparse.sh +0 -234
- data/src/cxx_supportlib/vendor-copy/libuv/common.gypi +0 -210
- data/src/cxx_supportlib/vendor-copy/libuv/gyp_uv.py +0 -93
- data/src/cxx_supportlib/vendor-copy/libuv/include/android-ifaddrs.h +0 -54
- data/src/cxx_supportlib/vendor-copy/libuv/include/pthread-fixes.h +0 -72
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/android-ifaddrs.c +0 -703
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/atomic-ops.h +0 -77
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-core.c +0 -899
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-inotify.c +0 -285
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.c +0 -471
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.h +0 -158
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pthread-fixes.c +0 -104
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/spinlock.h +0 -53
- data/src/cxx_supportlib/vendor-copy/libuv/uv.gyp +0 -508
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-aix.h → uv/aix.h} +0 -0
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-bsd.h → uv/bsd.h} +0 -0
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-sunos.h → uv/sunos.h} +0 -0
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
#include <errno.h>
|
|
28
28
|
#include <stdlib.h>
|
|
29
29
|
#include <unistd.h>
|
|
30
|
+
#if defined(__MVS__)
|
|
31
|
+
#include <xti.h>
|
|
32
|
+
#endif
|
|
33
|
+
#include <sys/un.h>
|
|
30
34
|
|
|
31
35
|
#if defined(IPV6_JOIN_GROUP) && !defined(IPV6_ADD_MEMBERSHIP)
|
|
32
36
|
# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
|
|
@@ -36,7 +40,6 @@
|
|
|
36
40
|
# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
|
|
37
41
|
#endif
|
|
38
42
|
|
|
39
|
-
|
|
40
43
|
static void uv__udp_run_completed(uv_udp_t* handle);
|
|
41
44
|
static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents);
|
|
42
45
|
static void uv__udp_recvmsg(uv_udp_t* handle);
|
|
@@ -59,18 +62,18 @@ void uv__udp_close(uv_udp_t* handle) {
|
|
|
59
62
|
|
|
60
63
|
void uv__udp_finish_close(uv_udp_t* handle) {
|
|
61
64
|
uv_udp_send_t* req;
|
|
62
|
-
|
|
65
|
+
struct uv__queue* q;
|
|
63
66
|
|
|
64
|
-
assert(!uv__io_active(&handle->io_watcher,
|
|
67
|
+
assert(!uv__io_active(&handle->io_watcher, POLLIN | POLLOUT));
|
|
65
68
|
assert(handle->io_watcher.fd == -1);
|
|
66
69
|
|
|
67
|
-
while (!
|
|
68
|
-
q =
|
|
69
|
-
|
|
70
|
+
while (!uv__queue_empty(&handle->write_queue)) {
|
|
71
|
+
q = uv__queue_head(&handle->write_queue);
|
|
72
|
+
uv__queue_remove(q);
|
|
70
73
|
|
|
71
|
-
req =
|
|
72
|
-
req->status =
|
|
73
|
-
|
|
74
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
75
|
+
req->status = UV_ECANCELED;
|
|
76
|
+
uv__queue_insert_tail(&handle->write_completed_queue, &req->queue);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
uv__udp_run_completed(handle);
|
|
@@ -87,17 +90,17 @@ void uv__udp_finish_close(uv_udp_t* handle) {
|
|
|
87
90
|
|
|
88
91
|
static void uv__udp_run_completed(uv_udp_t* handle) {
|
|
89
92
|
uv_udp_send_t* req;
|
|
90
|
-
|
|
93
|
+
struct uv__queue* q;
|
|
91
94
|
|
|
92
|
-
assert(!(handle->flags &
|
|
93
|
-
handle->flags |=
|
|
95
|
+
assert(!(handle->flags & UV_HANDLE_UDP_PROCESSING));
|
|
96
|
+
handle->flags |= UV_HANDLE_UDP_PROCESSING;
|
|
94
97
|
|
|
95
|
-
while (!
|
|
96
|
-
q =
|
|
97
|
-
|
|
98
|
+
while (!uv__queue_empty(&handle->write_completed_queue)) {
|
|
99
|
+
q = uv__queue_head(&handle->write_completed_queue);
|
|
100
|
+
uv__queue_remove(q);
|
|
98
101
|
|
|
99
|
-
req =
|
|
100
|
-
uv__req_unregister(handle->loop
|
|
102
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
103
|
+
uv__req_unregister(handle->loop);
|
|
101
104
|
|
|
102
105
|
handle->send_queue_size -= uv__count_bufs(req->bufs, req->nbufs);
|
|
103
106
|
handle->send_queue_count--;
|
|
@@ -118,14 +121,14 @@ static void uv__udp_run_completed(uv_udp_t* handle) {
|
|
|
118
121
|
req->send_cb(req, req->status);
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
if (
|
|
124
|
+
if (uv__queue_empty(&handle->write_queue)) {
|
|
122
125
|
/* Pending queue and completion queue empty, stop watcher. */
|
|
123
|
-
uv__io_stop(handle->loop, &handle->io_watcher,
|
|
124
|
-
if (!uv__io_active(&handle->io_watcher,
|
|
126
|
+
uv__io_stop(handle->loop, &handle->io_watcher, POLLOUT);
|
|
127
|
+
if (!uv__io_active(&handle->io_watcher, POLLIN))
|
|
125
128
|
uv__handle_stop(handle);
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
handle->flags &= ~
|
|
131
|
+
handle->flags &= ~UV_HANDLE_UDP_PROCESSING;
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
|
|
@@ -135,15 +138,83 @@ static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents) {
|
|
|
135
138
|
handle = container_of(w, uv_udp_t, io_watcher);
|
|
136
139
|
assert(handle->type == UV_UDP);
|
|
137
140
|
|
|
138
|
-
if (revents &
|
|
141
|
+
if (revents & POLLIN)
|
|
139
142
|
uv__udp_recvmsg(handle);
|
|
140
143
|
|
|
141
|
-
if (revents &
|
|
144
|
+
if (revents & POLLOUT && !uv__is_closing(handle)) {
|
|
142
145
|
uv__udp_sendmsg(handle);
|
|
143
146
|
uv__udp_run_completed(handle);
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
|
|
150
|
+
static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
|
|
151
|
+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
|
152
|
+
struct sockaddr_in6 peers[20];
|
|
153
|
+
struct iovec iov[ARRAY_SIZE(peers)];
|
|
154
|
+
struct mmsghdr msgs[ARRAY_SIZE(peers)];
|
|
155
|
+
ssize_t nread;
|
|
156
|
+
uv_buf_t chunk_buf;
|
|
157
|
+
size_t chunks;
|
|
158
|
+
int flags;
|
|
159
|
+
size_t k;
|
|
160
|
+
|
|
161
|
+
/* prepare structures for recvmmsg */
|
|
162
|
+
chunks = buf->len / UV__UDP_DGRAM_MAXSIZE;
|
|
163
|
+
if (chunks > ARRAY_SIZE(iov))
|
|
164
|
+
chunks = ARRAY_SIZE(iov);
|
|
165
|
+
for (k = 0; k < chunks; ++k) {
|
|
166
|
+
iov[k].iov_base = buf->base + k * UV__UDP_DGRAM_MAXSIZE;
|
|
167
|
+
iov[k].iov_len = UV__UDP_DGRAM_MAXSIZE;
|
|
168
|
+
memset(&msgs[k].msg_hdr, 0, sizeof(msgs[k].msg_hdr));
|
|
169
|
+
msgs[k].msg_hdr.msg_iov = iov + k;
|
|
170
|
+
msgs[k].msg_hdr.msg_iovlen = 1;
|
|
171
|
+
msgs[k].msg_hdr.msg_name = peers + k;
|
|
172
|
+
msgs[k].msg_hdr.msg_namelen = sizeof(peers[0]);
|
|
173
|
+
msgs[k].msg_hdr.msg_control = NULL;
|
|
174
|
+
msgs[k].msg_hdr.msg_controllen = 0;
|
|
175
|
+
msgs[k].msg_hdr.msg_flags = 0;
|
|
176
|
+
msgs[k].msg_len = 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#if defined(__APPLE__)
|
|
180
|
+
do
|
|
181
|
+
nread = recvmsg_x(handle->io_watcher.fd, msgs, chunks, MSG_DONTWAIT);
|
|
182
|
+
while (nread == -1 && errno == EINTR);
|
|
183
|
+
#else
|
|
184
|
+
do
|
|
185
|
+
nread = recvmmsg(handle->io_watcher.fd, msgs, chunks, 0, NULL);
|
|
186
|
+
while (nread == -1 && errno == EINTR);
|
|
187
|
+
#endif
|
|
188
|
+
|
|
189
|
+
if (nread < 1) {
|
|
190
|
+
if (nread == 0 || errno == EAGAIN || errno == EWOULDBLOCK)
|
|
191
|
+
handle->recv_cb(handle, 0, buf, NULL, 0);
|
|
192
|
+
else
|
|
193
|
+
handle->recv_cb(handle, UV__ERR(errno), buf, NULL, 0);
|
|
194
|
+
} else {
|
|
195
|
+
/* pass each chunk to the application */
|
|
196
|
+
for (k = 0; k < (size_t) nread && handle->recv_cb != NULL; k++) {
|
|
197
|
+
flags = UV_UDP_MMSG_CHUNK;
|
|
198
|
+
if (msgs[k].msg_hdr.msg_flags & MSG_TRUNC)
|
|
199
|
+
flags |= UV_UDP_PARTIAL;
|
|
200
|
+
|
|
201
|
+
chunk_buf = uv_buf_init(iov[k].iov_base, iov[k].iov_len);
|
|
202
|
+
handle->recv_cb(handle,
|
|
203
|
+
msgs[k].msg_len,
|
|
204
|
+
&chunk_buf,
|
|
205
|
+
msgs[k].msg_hdr.msg_name,
|
|
206
|
+
flags);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* one last callback so the original buffer is freed */
|
|
210
|
+
if (handle->recv_cb != NULL)
|
|
211
|
+
handle->recv_cb(handle, 0, buf, NULL, UV_UDP_MMSG_FREE);
|
|
212
|
+
}
|
|
213
|
+
return nread;
|
|
214
|
+
#else /* __linux__ || ____FreeBSD__ || __APPLE__ */
|
|
215
|
+
return UV_ENOSYS;
|
|
216
|
+
#endif /* __linux__ || ____FreeBSD__ || __APPLE__ */
|
|
217
|
+
}
|
|
147
218
|
|
|
148
219
|
static void uv__udp_recvmsg(uv_udp_t* handle) {
|
|
149
220
|
struct sockaddr_storage peer;
|
|
@@ -161,17 +232,25 @@ static void uv__udp_recvmsg(uv_udp_t* handle) {
|
|
|
161
232
|
*/
|
|
162
233
|
count = 32;
|
|
163
234
|
|
|
164
|
-
memset(&h, 0, sizeof(h));
|
|
165
|
-
h.msg_name = &peer;
|
|
166
|
-
|
|
167
235
|
do {
|
|
168
|
-
|
|
169
|
-
|
|
236
|
+
buf = uv_buf_init(NULL, 0);
|
|
237
|
+
handle->alloc_cb((uv_handle_t*) handle, UV__UDP_DGRAM_MAXSIZE, &buf);
|
|
238
|
+
if (buf.base == NULL || buf.len == 0) {
|
|
170
239
|
handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0);
|
|
171
240
|
return;
|
|
172
241
|
}
|
|
173
242
|
assert(buf.base != NULL);
|
|
174
243
|
|
|
244
|
+
if (uv_udp_using_recvmmsg(handle)) {
|
|
245
|
+
nread = uv__udp_recvmmsg(handle, &buf);
|
|
246
|
+
if (nread > 0)
|
|
247
|
+
count -= nread;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
memset(&h, 0, sizeof(h));
|
|
252
|
+
memset(&peer, 0, sizeof(peer));
|
|
253
|
+
h.msg_name = &peer;
|
|
175
254
|
h.msg_namelen = sizeof(peer);
|
|
176
255
|
h.msg_iov = (void*) &buf;
|
|
177
256
|
h.msg_iovlen = 1;
|
|
@@ -185,95 +264,252 @@ static void uv__udp_recvmsg(uv_udp_t* handle) {
|
|
|
185
264
|
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
|
186
265
|
handle->recv_cb(handle, 0, &buf, NULL, 0);
|
|
187
266
|
else
|
|
188
|
-
handle->recv_cb(handle,
|
|
267
|
+
handle->recv_cb(handle, UV__ERR(errno), &buf, NULL, 0);
|
|
189
268
|
}
|
|
190
269
|
else {
|
|
191
|
-
const struct sockaddr *addr;
|
|
192
|
-
if (h.msg_namelen == 0)
|
|
193
|
-
addr = NULL;
|
|
194
|
-
else
|
|
195
|
-
addr = (const struct sockaddr*) &peer;
|
|
196
|
-
|
|
197
270
|
flags = 0;
|
|
198
271
|
if (h.msg_flags & MSG_TRUNC)
|
|
199
272
|
flags |= UV_UDP_PARTIAL;
|
|
200
273
|
|
|
201
|
-
handle->recv_cb(handle, nread, &buf,
|
|
274
|
+
handle->recv_cb(handle, nread, &buf, (const struct sockaddr*) &peer, flags);
|
|
202
275
|
}
|
|
276
|
+
count--;
|
|
203
277
|
}
|
|
204
278
|
/* recv_cb callback may decide to pause or close the handle */
|
|
205
279
|
while (nread != -1
|
|
206
|
-
&& count
|
|
280
|
+
&& count > 0
|
|
207
281
|
&& handle->io_watcher.fd != -1
|
|
208
282
|
&& handle->recv_cb != NULL);
|
|
209
283
|
}
|
|
210
284
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
uv_udp_send_t* req;
|
|
214
|
-
QUEUE* q;
|
|
285
|
+
static void uv__udp_sendmsg_one(uv_udp_t* handle, uv_udp_send_t* req) {
|
|
286
|
+
struct uv__queue* q;
|
|
215
287
|
struct msghdr h;
|
|
216
288
|
ssize_t size;
|
|
217
289
|
|
|
218
|
-
|
|
219
|
-
q = QUEUE_HEAD(&handle->write_queue);
|
|
220
|
-
assert(q != NULL);
|
|
221
|
-
|
|
222
|
-
req = QUEUE_DATA(q, uv_udp_send_t, queue);
|
|
223
|
-
assert(req != NULL);
|
|
224
|
-
|
|
290
|
+
for (;;) {
|
|
225
291
|
memset(&h, 0, sizeof h);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
292
|
+
if (req->addr.ss_family == AF_UNSPEC) {
|
|
293
|
+
h.msg_name = NULL;
|
|
294
|
+
h.msg_namelen = 0;
|
|
295
|
+
} else {
|
|
296
|
+
h.msg_name = &req->addr;
|
|
297
|
+
if (req->addr.ss_family == AF_INET6)
|
|
298
|
+
h.msg_namelen = sizeof(struct sockaddr_in6);
|
|
299
|
+
else if (req->addr.ss_family == AF_INET)
|
|
300
|
+
h.msg_namelen = sizeof(struct sockaddr_in);
|
|
301
|
+
else if (req->addr.ss_family == AF_UNIX)
|
|
302
|
+
h.msg_namelen = sizeof(struct sockaddr_un);
|
|
303
|
+
else {
|
|
304
|
+
assert(0 && "unsupported address family");
|
|
305
|
+
abort();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
229
308
|
h.msg_iov = (struct iovec*) req->bufs;
|
|
230
309
|
h.msg_iovlen = req->nbufs;
|
|
231
310
|
|
|
232
|
-
do
|
|
311
|
+
do
|
|
233
312
|
size = sendmsg(handle->io_watcher.fd, &h, 0);
|
|
234
|
-
|
|
313
|
+
while (size == -1 && errno == EINTR);
|
|
235
314
|
|
|
236
|
-
if (size == -1
|
|
237
|
-
|
|
315
|
+
if (size == -1)
|
|
316
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
|
|
317
|
+
return;
|
|
238
318
|
|
|
239
|
-
req->status = (size == -1 ?
|
|
319
|
+
req->status = (size == -1 ? UV__ERR(errno) : size);
|
|
240
320
|
|
|
241
321
|
/* Sending a datagram is an atomic operation: either all data
|
|
242
322
|
* is written or nothing is (and EMSGSIZE is raised). That is
|
|
243
323
|
* why we don't handle partial writes. Just pop the request
|
|
244
324
|
* off the write queue and onto the completed queue, done.
|
|
245
325
|
*/
|
|
246
|
-
|
|
247
|
-
|
|
326
|
+
uv__queue_remove(&req->queue);
|
|
327
|
+
uv__queue_insert_tail(&handle->write_completed_queue, &req->queue);
|
|
248
328
|
uv__io_feed(handle->loop, &handle->io_watcher);
|
|
329
|
+
|
|
330
|
+
if (uv__queue_empty(&handle->write_queue))
|
|
331
|
+
return;
|
|
332
|
+
|
|
333
|
+
q = uv__queue_head(&handle->write_queue);
|
|
334
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
249
335
|
}
|
|
250
336
|
}
|
|
251
337
|
|
|
338
|
+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
|
339
|
+
static void uv__udp_sendmsg_many(uv_udp_t* handle) {
|
|
340
|
+
uv_udp_send_t* req;
|
|
341
|
+
struct mmsghdr h[20];
|
|
342
|
+
struct mmsghdr* p;
|
|
343
|
+
struct uv__queue* q;
|
|
344
|
+
ssize_t npkts;
|
|
345
|
+
size_t pkts;
|
|
346
|
+
size_t i;
|
|
347
|
+
|
|
348
|
+
write_queue_drain:
|
|
349
|
+
for (pkts = 0, q = uv__queue_head(&handle->write_queue);
|
|
350
|
+
pkts < ARRAY_SIZE(h) && q != &handle->write_queue;
|
|
351
|
+
++pkts, q = uv__queue_head(q)) {
|
|
352
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
353
|
+
|
|
354
|
+
p = &h[pkts];
|
|
355
|
+
memset(p, 0, sizeof(*p));
|
|
356
|
+
if (req->addr.ss_family == AF_UNSPEC) {
|
|
357
|
+
p->msg_hdr.msg_name = NULL;
|
|
358
|
+
p->msg_hdr.msg_namelen = 0;
|
|
359
|
+
} else {
|
|
360
|
+
p->msg_hdr.msg_name = &req->addr;
|
|
361
|
+
if (req->addr.ss_family == AF_INET6)
|
|
362
|
+
p->msg_hdr.msg_namelen = sizeof(struct sockaddr_in6);
|
|
363
|
+
else if (req->addr.ss_family == AF_INET)
|
|
364
|
+
p->msg_hdr.msg_namelen = sizeof(struct sockaddr_in);
|
|
365
|
+
else if (req->addr.ss_family == AF_UNIX)
|
|
366
|
+
p->msg_hdr.msg_namelen = sizeof(struct sockaddr_un);
|
|
367
|
+
else {
|
|
368
|
+
assert(0 && "unsupported address family");
|
|
369
|
+
abort();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
h[pkts].msg_hdr.msg_iov = (struct iovec*) req->bufs;
|
|
373
|
+
h[pkts].msg_hdr.msg_iovlen = req->nbufs;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
#if defined(__APPLE__)
|
|
377
|
+
do
|
|
378
|
+
npkts = sendmsg_x(handle->io_watcher.fd, h, pkts, MSG_DONTWAIT);
|
|
379
|
+
while (npkts == -1 && errno == EINTR);
|
|
380
|
+
#else
|
|
381
|
+
do
|
|
382
|
+
npkts = sendmmsg(handle->io_watcher.fd, h, pkts, 0);
|
|
383
|
+
while (npkts == -1 && errno == EINTR);
|
|
384
|
+
#endif
|
|
385
|
+
|
|
386
|
+
if (npkts < 1) {
|
|
387
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
|
|
388
|
+
return;
|
|
389
|
+
for (i = 0, q = uv__queue_head(&handle->write_queue);
|
|
390
|
+
i < pkts && q != &handle->write_queue;
|
|
391
|
+
++i, q = uv__queue_head(&handle->write_queue)) {
|
|
392
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
393
|
+
req->status = UV__ERR(errno);
|
|
394
|
+
uv__queue_remove(&req->queue);
|
|
395
|
+
uv__queue_insert_tail(&handle->write_completed_queue, &req->queue);
|
|
396
|
+
}
|
|
397
|
+
uv__io_feed(handle->loop, &handle->io_watcher);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* Safety: npkts known to be >0 below. Hence cast from ssize_t
|
|
402
|
+
* to size_t safe.
|
|
403
|
+
*/
|
|
404
|
+
for (i = 0, q = uv__queue_head(&handle->write_queue);
|
|
405
|
+
i < (size_t)npkts && q != &handle->write_queue;
|
|
406
|
+
++i, q = uv__queue_head(&handle->write_queue)) {
|
|
407
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
408
|
+
req->status = req->bufs[0].len;
|
|
409
|
+
|
|
410
|
+
/* Sending a datagram is an atomic operation: either all data
|
|
411
|
+
* is written or nothing is (and EMSGSIZE is raised). That is
|
|
412
|
+
* why we don't handle partial writes. Just pop the request
|
|
413
|
+
* off the write queue and onto the completed queue, done.
|
|
414
|
+
*/
|
|
415
|
+
uv__queue_remove(&req->queue);
|
|
416
|
+
uv__queue_insert_tail(&handle->write_completed_queue, &req->queue);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/* couldn't batch everything, continue sending (jump to avoid stack growth) */
|
|
420
|
+
if (!uv__queue_empty(&handle->write_queue))
|
|
421
|
+
goto write_queue_drain;
|
|
422
|
+
|
|
423
|
+
uv__io_feed(handle->loop, &handle->io_watcher);
|
|
424
|
+
}
|
|
425
|
+
#endif /* __linux__ || ____FreeBSD__ || __APPLE__ */
|
|
426
|
+
|
|
427
|
+
static void uv__udp_sendmsg(uv_udp_t* handle) {
|
|
428
|
+
struct uv__queue* q;
|
|
429
|
+
uv_udp_send_t* req;
|
|
430
|
+
|
|
431
|
+
if (uv__queue_empty(&handle->write_queue))
|
|
432
|
+
return;
|
|
433
|
+
|
|
434
|
+
q = uv__queue_head(&handle->write_queue);
|
|
435
|
+
req = uv__queue_data(q, uv_udp_send_t, queue);
|
|
436
|
+
|
|
437
|
+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
|
438
|
+
/* Use sendmmsg() if this send request contains more than one datagram OR
|
|
439
|
+
* there is more than one send request (because that automatically implies
|
|
440
|
+
* there is more than one datagram.)
|
|
441
|
+
*/
|
|
442
|
+
if (req->nbufs != 1 || &handle->write_queue != uv__queue_next(&req->queue))
|
|
443
|
+
return uv__udp_sendmsg_many(handle);
|
|
444
|
+
#endif
|
|
445
|
+
|
|
446
|
+
return uv__udp_sendmsg_one(handle, req);
|
|
447
|
+
}
|
|
252
448
|
|
|
253
449
|
/* On the BSDs, SO_REUSEPORT implies SO_REUSEADDR but with some additional
|
|
254
|
-
* refinements for programs that use multicast.
|
|
450
|
+
* refinements for programs that use multicast. Therefore we preferentially
|
|
451
|
+
* set SO_REUSEPORT over SO_REUSEADDR here, but we set SO_REUSEPORT only
|
|
452
|
+
* when that socket option doesn't have the capability of load balancing.
|
|
453
|
+
* Otherwise, we fall back to SO_REUSEADDR.
|
|
255
454
|
*
|
|
256
|
-
* Linux as of 3.9
|
|
257
|
-
* are different from the BSDs: it _shares_
|
|
258
|
-
* from the current listener.
|
|
259
|
-
* on other platforms so we don't enable it.
|
|
455
|
+
* Linux as of 3.9, DragonflyBSD 3.6, AIX 7.2.5 have the SO_REUSEPORT socket
|
|
456
|
+
* option but with semantics that are different from the BSDs: it _shares_
|
|
457
|
+
* the port rather than steals it from the current listener. While useful,
|
|
458
|
+
* it's not something we can emulate on other platforms so we don't enable it.
|
|
459
|
+
*
|
|
460
|
+
* zOS does not support getsockname with SO_REUSEPORT option when using
|
|
461
|
+
* AF_UNIX.
|
|
260
462
|
*/
|
|
261
|
-
static int
|
|
463
|
+
static int uv__sock_reuseaddr(int fd) {
|
|
262
464
|
int yes;
|
|
263
|
-
|
|
264
|
-
#if defined(SO_REUSEPORT) && !defined(__linux__)
|
|
265
465
|
yes = 1;
|
|
466
|
+
|
|
467
|
+
#if defined(SO_REUSEPORT) && defined(__MVS__)
|
|
468
|
+
struct sockaddr_in sockfd;
|
|
469
|
+
unsigned int sockfd_len = sizeof(sockfd);
|
|
470
|
+
if (getsockname(fd, (struct sockaddr*) &sockfd, &sockfd_len) == -1)
|
|
471
|
+
return UV__ERR(errno);
|
|
472
|
+
if (sockfd.sin_family == AF_UNIX) {
|
|
473
|
+
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)))
|
|
474
|
+
return UV__ERR(errno);
|
|
475
|
+
} else {
|
|
476
|
+
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)))
|
|
477
|
+
return UV__ERR(errno);
|
|
478
|
+
}
|
|
479
|
+
#elif defined(SO_REUSEPORT) && !defined(__linux__) && !defined(__GNU__) && \
|
|
480
|
+
!defined(__sun__) && !defined(__DragonFly__) && !defined(_AIX73)
|
|
266
481
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)))
|
|
267
|
-
return
|
|
482
|
+
return UV__ERR(errno);
|
|
268
483
|
#else
|
|
269
|
-
yes = 1;
|
|
270
484
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)))
|
|
271
|
-
return
|
|
485
|
+
return UV__ERR(errno);
|
|
272
486
|
#endif
|
|
273
487
|
|
|
274
488
|
return 0;
|
|
275
489
|
}
|
|
276
490
|
|
|
491
|
+
/*
|
|
492
|
+
* The Linux kernel suppresses some ICMP error messages by default for UDP
|
|
493
|
+
* sockets. Setting IP_RECVERR/IPV6_RECVERR on the socket enables full ICMP
|
|
494
|
+
* error reporting, hopefully resulting in faster failover to working name
|
|
495
|
+
* servers.
|
|
496
|
+
*/
|
|
497
|
+
static int uv__set_recverr(int fd, sa_family_t ss_family) {
|
|
498
|
+
#if defined(__linux__)
|
|
499
|
+
int yes;
|
|
500
|
+
|
|
501
|
+
yes = 1;
|
|
502
|
+
if (ss_family == AF_INET) {
|
|
503
|
+
if (setsockopt(fd, IPPROTO_IP, IP_RECVERR, &yes, sizeof(yes)))
|
|
504
|
+
return UV__ERR(errno);
|
|
505
|
+
} else if (ss_family == AF_INET6) {
|
|
506
|
+
if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVERR, &yes, sizeof(yes)))
|
|
507
|
+
return UV__ERR(errno);
|
|
508
|
+
}
|
|
509
|
+
#endif
|
|
510
|
+
return 0;
|
|
511
|
+
}
|
|
512
|
+
|
|
277
513
|
|
|
278
514
|
int uv__udp_bind(uv_udp_t* handle,
|
|
279
515
|
const struct sockaddr* addr,
|
|
@@ -284,12 +520,13 @@ int uv__udp_bind(uv_udp_t* handle,
|
|
|
284
520
|
int fd;
|
|
285
521
|
|
|
286
522
|
/* Check for bad flags. */
|
|
287
|
-
if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR
|
|
288
|
-
|
|
523
|
+
if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR |
|
|
524
|
+
UV_UDP_REUSEPORT | UV_UDP_LINUX_RECVERR))
|
|
525
|
+
return UV_EINVAL;
|
|
289
526
|
|
|
290
527
|
/* Cannot set IPv6-only mode on non-IPv6 socket. */
|
|
291
528
|
if ((flags & UV_UDP_IPV6ONLY) && addr->sa_family != AF_INET6)
|
|
292
|
-
return
|
|
529
|
+
return UV_EINVAL;
|
|
293
530
|
|
|
294
531
|
fd = handle->io_watcher.fd;
|
|
295
532
|
if (fd == -1) {
|
|
@@ -300,50 +537,58 @@ int uv__udp_bind(uv_udp_t* handle,
|
|
|
300
537
|
handle->io_watcher.fd = fd;
|
|
301
538
|
}
|
|
302
539
|
|
|
540
|
+
if (flags & UV_UDP_LINUX_RECVERR) {
|
|
541
|
+
err = uv__set_recverr(fd, addr->sa_family);
|
|
542
|
+
if (err)
|
|
543
|
+
return err;
|
|
544
|
+
}
|
|
545
|
+
|
|
303
546
|
if (flags & UV_UDP_REUSEADDR) {
|
|
304
|
-
err =
|
|
547
|
+
err = uv__sock_reuseaddr(fd);
|
|
305
548
|
if (err)
|
|
306
|
-
|
|
549
|
+
return err;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (flags & UV_UDP_REUSEPORT) {
|
|
553
|
+
err = uv__sock_reuseport(fd);
|
|
554
|
+
if (err)
|
|
555
|
+
return err;
|
|
307
556
|
}
|
|
308
557
|
|
|
309
558
|
if (flags & UV_UDP_IPV6ONLY) {
|
|
310
559
|
#ifdef IPV6_V6ONLY
|
|
311
560
|
yes = 1;
|
|
312
561
|
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof yes) == -1) {
|
|
313
|
-
err =
|
|
314
|
-
|
|
562
|
+
err = UV__ERR(errno);
|
|
563
|
+
return err;
|
|
315
564
|
}
|
|
316
565
|
#else
|
|
317
|
-
err =
|
|
318
|
-
|
|
566
|
+
err = UV_ENOTSUP;
|
|
567
|
+
return err;
|
|
319
568
|
#endif
|
|
320
569
|
}
|
|
321
570
|
|
|
322
571
|
if (bind(fd, addr, addrlen)) {
|
|
323
|
-
err =
|
|
572
|
+
err = UV__ERR(errno);
|
|
324
573
|
if (errno == EAFNOSUPPORT)
|
|
325
574
|
/* OSX, other BSDs and SunoS fail with EAFNOSUPPORT when binding a
|
|
326
575
|
* socket created with AF_INET to an AF_INET6 address or vice versa. */
|
|
327
|
-
err =
|
|
328
|
-
|
|
576
|
+
err = UV_EINVAL;
|
|
577
|
+
return err;
|
|
329
578
|
}
|
|
330
579
|
|
|
331
580
|
if (addr->sa_family == AF_INET6)
|
|
332
581
|
handle->flags |= UV_HANDLE_IPV6;
|
|
333
582
|
|
|
583
|
+
handle->flags |= UV_HANDLE_BOUND;
|
|
334
584
|
return 0;
|
|
335
|
-
|
|
336
|
-
out:
|
|
337
|
-
uv__close(handle->io_watcher.fd);
|
|
338
|
-
handle->io_watcher.fd = -1;
|
|
339
|
-
return err;
|
|
340
585
|
}
|
|
341
586
|
|
|
342
587
|
|
|
343
588
|
static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
|
|
344
589
|
int domain,
|
|
345
590
|
unsigned int flags) {
|
|
346
|
-
|
|
591
|
+
union uv__sockaddr taddr;
|
|
347
592
|
socklen_t addrlen;
|
|
348
593
|
|
|
349
594
|
if (handle->io_watcher.fd != -1)
|
|
@@ -352,7 +597,7 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
|
|
|
352
597
|
switch (domain) {
|
|
353
598
|
case AF_INET:
|
|
354
599
|
{
|
|
355
|
-
struct sockaddr_in* addr =
|
|
600
|
+
struct sockaddr_in* addr = &taddr.in;
|
|
356
601
|
memset(addr, 0, sizeof *addr);
|
|
357
602
|
addr->sin_family = AF_INET;
|
|
358
603
|
addr->sin_addr.s_addr = INADDR_ANY;
|
|
@@ -361,7 +606,7 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
|
|
|
361
606
|
}
|
|
362
607
|
case AF_INET6:
|
|
363
608
|
{
|
|
364
|
-
struct sockaddr_in6* addr =
|
|
609
|
+
struct sockaddr_in6* addr = &taddr.in6;
|
|
365
610
|
memset(addr, 0, sizeof *addr);
|
|
366
611
|
addr->sin6_family = AF_INET6;
|
|
367
612
|
addr->sin6_addr = in6addr_any;
|
|
@@ -373,9 +618,105 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
|
|
|
373
618
|
abort();
|
|
374
619
|
}
|
|
375
620
|
|
|
376
|
-
return uv__udp_bind(handle,
|
|
621
|
+
return uv__udp_bind(handle, &taddr.addr, addrlen, flags);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
int uv__udp_connect(uv_udp_t* handle,
|
|
626
|
+
const struct sockaddr* addr,
|
|
627
|
+
unsigned int addrlen) {
|
|
628
|
+
int err;
|
|
629
|
+
|
|
630
|
+
err = uv__udp_maybe_deferred_bind(handle, addr->sa_family, 0);
|
|
631
|
+
if (err)
|
|
632
|
+
return err;
|
|
633
|
+
|
|
634
|
+
do {
|
|
635
|
+
errno = 0;
|
|
636
|
+
err = connect(handle->io_watcher.fd, addr, addrlen);
|
|
637
|
+
} while (err == -1 && errno == EINTR);
|
|
638
|
+
|
|
639
|
+
if (err)
|
|
640
|
+
return UV__ERR(errno);
|
|
641
|
+
|
|
642
|
+
handle->flags |= UV_HANDLE_UDP_CONNECTED;
|
|
643
|
+
|
|
644
|
+
return 0;
|
|
377
645
|
}
|
|
378
646
|
|
|
647
|
+
/* From https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
|
|
648
|
+
* Any of uv supported UNIXs kernel should be standardized, but the kernel
|
|
649
|
+
* implementation logic not same, let's use pseudocode to explain the udp
|
|
650
|
+
* disconnect behaviors:
|
|
651
|
+
*
|
|
652
|
+
* Predefined stubs for pseudocode:
|
|
653
|
+
* 1. sodisconnect: The function to perform the real udp disconnect
|
|
654
|
+
* 2. pru_connect: The function to perform the real udp connect
|
|
655
|
+
* 3. so: The kernel object match with socket fd
|
|
656
|
+
* 4. addr: The sockaddr parameter from user space
|
|
657
|
+
*
|
|
658
|
+
* BSDs:
|
|
659
|
+
* if(sodisconnect(so) == 0) { // udp disconnect succeed
|
|
660
|
+
* if (addr->sa_len != so->addr->sa_len) return EINVAL;
|
|
661
|
+
* if (addr->sa_family != so->addr->sa_family) return EAFNOSUPPORT;
|
|
662
|
+
* pru_connect(so);
|
|
663
|
+
* }
|
|
664
|
+
* else return EISCONN;
|
|
665
|
+
*
|
|
666
|
+
* z/OS (same with Windows):
|
|
667
|
+
* if(addr->sa_len < so->addr->sa_len) return EINVAL;
|
|
668
|
+
* if (addr->sa_family == AF_UNSPEC) sodisconnect(so);
|
|
669
|
+
*
|
|
670
|
+
* AIX:
|
|
671
|
+
* if(addr->sa_len != sizeof(struct sockaddr)) return EINVAL; // ignore ip proto version
|
|
672
|
+
* if (addr->sa_family == AF_UNSPEC) sodisconnect(so);
|
|
673
|
+
*
|
|
674
|
+
* Linux,Others:
|
|
675
|
+
* if(addr->sa_len < sizeof(struct sockaddr)) return EINVAL;
|
|
676
|
+
* if (addr->sa_family == AF_UNSPEC) sodisconnect(so);
|
|
677
|
+
*/
|
|
678
|
+
int uv__udp_disconnect(uv_udp_t* handle) {
|
|
679
|
+
int r;
|
|
680
|
+
#if defined(__MVS__)
|
|
681
|
+
struct sockaddr_storage addr;
|
|
682
|
+
#else
|
|
683
|
+
struct sockaddr addr;
|
|
684
|
+
#endif
|
|
685
|
+
|
|
686
|
+
memset(&addr, 0, sizeof(addr));
|
|
687
|
+
|
|
688
|
+
#if defined(__MVS__)
|
|
689
|
+
addr.ss_family = AF_UNSPEC;
|
|
690
|
+
#else
|
|
691
|
+
addr.sa_family = AF_UNSPEC;
|
|
692
|
+
#endif
|
|
693
|
+
|
|
694
|
+
do {
|
|
695
|
+
errno = 0;
|
|
696
|
+
#ifdef __PASE__
|
|
697
|
+
/* On IBMi a connectionless transport socket can be disconnected by
|
|
698
|
+
* either setting the addr parameter to NULL or setting the
|
|
699
|
+
* addr_length parameter to zero, and issuing another connect().
|
|
700
|
+
* https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/connec.htm
|
|
701
|
+
*/
|
|
702
|
+
r = connect(handle->io_watcher.fd, (struct sockaddr*) NULL, 0);
|
|
703
|
+
#else
|
|
704
|
+
r = connect(handle->io_watcher.fd, (struct sockaddr*) &addr, sizeof(addr));
|
|
705
|
+
#endif
|
|
706
|
+
} while (r == -1 && errno == EINTR);
|
|
707
|
+
|
|
708
|
+
if (r == -1) {
|
|
709
|
+
#if defined(BSD) /* The macro BSD is from sys/param.h */
|
|
710
|
+
if (errno != EAFNOSUPPORT && errno != EINVAL)
|
|
711
|
+
return UV__ERR(errno);
|
|
712
|
+
#else
|
|
713
|
+
return UV__ERR(errno);
|
|
714
|
+
#endif
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
handle->flags &= ~UV_HANDLE_UDP_CONNECTED;
|
|
718
|
+
return 0;
|
|
719
|
+
}
|
|
379
720
|
|
|
380
721
|
int uv__udp_send(uv_udp_send_t* req,
|
|
381
722
|
uv_udp_t* handle,
|
|
@@ -389,9 +730,11 @@ int uv__udp_send(uv_udp_send_t* req,
|
|
|
389
730
|
|
|
390
731
|
assert(nbufs > 0);
|
|
391
732
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
733
|
+
if (addr) {
|
|
734
|
+
err = uv__udp_maybe_deferred_bind(handle, addr->sa_family, 0);
|
|
735
|
+
if (err)
|
|
736
|
+
return err;
|
|
737
|
+
}
|
|
395
738
|
|
|
396
739
|
/* It's legal for send_queue_count > 0 even when the write_queue is empty;
|
|
397
740
|
* it means there are error-state requests in the write_completed_queue that
|
|
@@ -401,7 +744,10 @@ int uv__udp_send(uv_udp_send_t* req,
|
|
|
401
744
|
|
|
402
745
|
uv__req_init(handle->loop, req, UV_UDP_SEND);
|
|
403
746
|
assert(addrlen <= sizeof(req->addr));
|
|
404
|
-
|
|
747
|
+
if (addr == NULL)
|
|
748
|
+
req->addr.ss_family = AF_UNSPEC;
|
|
749
|
+
else
|
|
750
|
+
memcpy(&req->addr, addr, addrlen);
|
|
405
751
|
req->send_cb = send_cb;
|
|
406
752
|
req->handle = handle;
|
|
407
753
|
req->nbufs = nbufs;
|
|
@@ -411,20 +757,27 @@ int uv__udp_send(uv_udp_send_t* req,
|
|
|
411
757
|
req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
|
|
412
758
|
|
|
413
759
|
if (req->bufs == NULL) {
|
|
414
|
-
uv__req_unregister(handle->loop
|
|
415
|
-
return
|
|
760
|
+
uv__req_unregister(handle->loop);
|
|
761
|
+
return UV_ENOMEM;
|
|
416
762
|
}
|
|
417
763
|
|
|
418
764
|
memcpy(req->bufs, bufs, nbufs * sizeof(bufs[0]));
|
|
419
765
|
handle->send_queue_size += uv__count_bufs(req->bufs, req->nbufs);
|
|
420
766
|
handle->send_queue_count++;
|
|
421
|
-
|
|
767
|
+
uv__queue_insert_tail(&handle->write_queue, &req->queue);
|
|
422
768
|
uv__handle_start(handle);
|
|
423
769
|
|
|
424
|
-
if (empty_queue && !(handle->flags &
|
|
770
|
+
if (empty_queue && !(handle->flags & UV_HANDLE_UDP_PROCESSING)) {
|
|
425
771
|
uv__udp_sendmsg(handle);
|
|
772
|
+
|
|
773
|
+
/* `uv__udp_sendmsg` may not be able to do non-blocking write straight
|
|
774
|
+
* away. In such cases the `io_watcher` has to be queued for asynchronous
|
|
775
|
+
* write.
|
|
776
|
+
*/
|
|
777
|
+
if (!uv__queue_empty(&handle->write_queue))
|
|
778
|
+
uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
|
|
426
779
|
} else {
|
|
427
|
-
uv__io_start(handle->loop, &handle->io_watcher,
|
|
780
|
+
uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
|
|
428
781
|
}
|
|
429
782
|
|
|
430
783
|
return 0;
|
|
@@ -444,11 +797,15 @@ int uv__udp_try_send(uv_udp_t* handle,
|
|
|
444
797
|
|
|
445
798
|
/* already sending a message */
|
|
446
799
|
if (handle->send_queue_count != 0)
|
|
447
|
-
return
|
|
800
|
+
return UV_EAGAIN;
|
|
448
801
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
802
|
+
if (addr) {
|
|
803
|
+
err = uv__udp_maybe_deferred_bind(handle, addr->sa_family, 0);
|
|
804
|
+
if (err)
|
|
805
|
+
return err;
|
|
806
|
+
} else {
|
|
807
|
+
assert(handle->flags & UV_HANDLE_UDP_CONNECTED);
|
|
808
|
+
}
|
|
452
809
|
|
|
453
810
|
memset(&h, 0, sizeof h);
|
|
454
811
|
h.msg_name = (struct sockaddr*) addr;
|
|
@@ -461,10 +818,10 @@ int uv__udp_try_send(uv_udp_t* handle,
|
|
|
461
818
|
} while (size == -1 && errno == EINTR);
|
|
462
819
|
|
|
463
820
|
if (size == -1) {
|
|
464
|
-
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
|
465
|
-
return
|
|
821
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
|
|
822
|
+
return UV_EAGAIN;
|
|
466
823
|
else
|
|
467
|
-
return
|
|
824
|
+
return UV__ERR(errno);
|
|
468
825
|
}
|
|
469
826
|
|
|
470
827
|
return size;
|
|
@@ -499,7 +856,7 @@ static int uv__udp_set_membership4(uv_udp_t* handle,
|
|
|
499
856
|
optname = IP_DROP_MEMBERSHIP;
|
|
500
857
|
break;
|
|
501
858
|
default:
|
|
502
|
-
return
|
|
859
|
+
return UV_EINVAL;
|
|
503
860
|
}
|
|
504
861
|
|
|
505
862
|
if (setsockopt(handle->io_watcher.fd,
|
|
@@ -507,7 +864,11 @@ static int uv__udp_set_membership4(uv_udp_t* handle,
|
|
|
507
864
|
optname,
|
|
508
865
|
&mreq,
|
|
509
866
|
sizeof(mreq))) {
|
|
510
|
-
|
|
867
|
+
#if defined(__MVS__)
|
|
868
|
+
if (errno == ENXIO)
|
|
869
|
+
return UV_ENODEV;
|
|
870
|
+
#endif
|
|
871
|
+
return UV__ERR(errno);
|
|
511
872
|
}
|
|
512
873
|
|
|
513
874
|
return 0;
|
|
@@ -526,7 +887,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
|
|
|
526
887
|
|
|
527
888
|
if (interface_addr) {
|
|
528
889
|
if (uv_ip6_addr(interface_addr, 0, &addr6))
|
|
529
|
-
return
|
|
890
|
+
return UV_EINVAL;
|
|
530
891
|
mreq.ipv6mr_interface = addr6.sin6_scope_id;
|
|
531
892
|
} else {
|
|
532
893
|
mreq.ipv6mr_interface = 0;
|
|
@@ -542,7 +903,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
|
|
|
542
903
|
optname = IPV6_DROP_MEMBERSHIP;
|
|
543
904
|
break;
|
|
544
905
|
default:
|
|
545
|
-
return
|
|
906
|
+
return UV_EINVAL;
|
|
546
907
|
}
|
|
547
908
|
|
|
548
909
|
if (setsockopt(handle->io_watcher.fd,
|
|
@@ -550,33 +911,129 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
|
|
|
550
911
|
optname,
|
|
551
912
|
&mreq,
|
|
552
913
|
sizeof(mreq))) {
|
|
553
|
-
|
|
914
|
+
#if defined(__MVS__)
|
|
915
|
+
if (errno == ENXIO)
|
|
916
|
+
return UV_ENODEV;
|
|
917
|
+
#endif
|
|
918
|
+
return UV__ERR(errno);
|
|
554
919
|
}
|
|
555
920
|
|
|
556
921
|
return 0;
|
|
557
922
|
}
|
|
558
923
|
|
|
559
924
|
|
|
560
|
-
|
|
561
|
-
|
|
925
|
+
#if !defined(__OpenBSD__) && \
|
|
926
|
+
!defined(__NetBSD__) && \
|
|
927
|
+
!defined(__ANDROID__) && \
|
|
928
|
+
!defined(__DragonFly__) && \
|
|
929
|
+
!defined(__QNX__) && \
|
|
930
|
+
!defined(__GNU__)
|
|
931
|
+
static int uv__udp_set_source_membership4(uv_udp_t* handle,
|
|
932
|
+
const struct sockaddr_in* multicast_addr,
|
|
933
|
+
const char* interface_addr,
|
|
934
|
+
const struct sockaddr_in* source_addr,
|
|
935
|
+
uv_membership membership) {
|
|
936
|
+
struct ip_mreq_source mreq;
|
|
937
|
+
int optname;
|
|
562
938
|
int err;
|
|
563
|
-
int fd;
|
|
564
939
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
return -EINVAL;
|
|
940
|
+
err = uv__udp_maybe_deferred_bind(handle, AF_INET, UV_UDP_REUSEADDR);
|
|
941
|
+
if (err)
|
|
942
|
+
return err;
|
|
569
943
|
|
|
570
|
-
|
|
571
|
-
return -EINVAL;
|
|
944
|
+
memset(&mreq, 0, sizeof(mreq));
|
|
572
945
|
|
|
573
|
-
if (
|
|
574
|
-
err =
|
|
575
|
-
if (err
|
|
946
|
+
if (interface_addr != NULL) {
|
|
947
|
+
err = uv_inet_pton(AF_INET, interface_addr, &mreq.imr_interface.s_addr);
|
|
948
|
+
if (err)
|
|
576
949
|
return err;
|
|
577
|
-
fd = err;
|
|
578
950
|
} else {
|
|
579
|
-
|
|
951
|
+
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
mreq.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr;
|
|
955
|
+
mreq.imr_sourceaddr.s_addr = source_addr->sin_addr.s_addr;
|
|
956
|
+
|
|
957
|
+
if (membership == UV_JOIN_GROUP)
|
|
958
|
+
optname = IP_ADD_SOURCE_MEMBERSHIP;
|
|
959
|
+
else if (membership == UV_LEAVE_GROUP)
|
|
960
|
+
optname = IP_DROP_SOURCE_MEMBERSHIP;
|
|
961
|
+
else
|
|
962
|
+
return UV_EINVAL;
|
|
963
|
+
|
|
964
|
+
if (setsockopt(handle->io_watcher.fd,
|
|
965
|
+
IPPROTO_IP,
|
|
966
|
+
optname,
|
|
967
|
+
&mreq,
|
|
968
|
+
sizeof(mreq))) {
|
|
969
|
+
return UV__ERR(errno);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
return 0;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
static int uv__udp_set_source_membership6(uv_udp_t* handle,
|
|
977
|
+
const struct sockaddr_in6* multicast_addr,
|
|
978
|
+
const char* interface_addr,
|
|
979
|
+
const struct sockaddr_in6* source_addr,
|
|
980
|
+
uv_membership membership) {
|
|
981
|
+
struct group_source_req mreq;
|
|
982
|
+
struct sockaddr_in6 addr6;
|
|
983
|
+
int optname;
|
|
984
|
+
int err;
|
|
985
|
+
|
|
986
|
+
err = uv__udp_maybe_deferred_bind(handle, AF_INET6, UV_UDP_REUSEADDR);
|
|
987
|
+
if (err)
|
|
988
|
+
return err;
|
|
989
|
+
|
|
990
|
+
memset(&mreq, 0, sizeof(mreq));
|
|
991
|
+
|
|
992
|
+
if (interface_addr != NULL) {
|
|
993
|
+
err = uv_ip6_addr(interface_addr, 0, &addr6);
|
|
994
|
+
if (err)
|
|
995
|
+
return err;
|
|
996
|
+
mreq.gsr_interface = addr6.sin6_scope_id;
|
|
997
|
+
} else {
|
|
998
|
+
mreq.gsr_interface = 0;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
STATIC_ASSERT(sizeof(mreq.gsr_group) >= sizeof(*multicast_addr));
|
|
1002
|
+
STATIC_ASSERT(sizeof(mreq.gsr_source) >= sizeof(*source_addr));
|
|
1003
|
+
memcpy(&mreq.gsr_group, multicast_addr, sizeof(*multicast_addr));
|
|
1004
|
+
memcpy(&mreq.gsr_source, source_addr, sizeof(*source_addr));
|
|
1005
|
+
|
|
1006
|
+
if (membership == UV_JOIN_GROUP)
|
|
1007
|
+
optname = MCAST_JOIN_SOURCE_GROUP;
|
|
1008
|
+
else if (membership == UV_LEAVE_GROUP)
|
|
1009
|
+
optname = MCAST_LEAVE_SOURCE_GROUP;
|
|
1010
|
+
else
|
|
1011
|
+
return UV_EINVAL;
|
|
1012
|
+
|
|
1013
|
+
if (setsockopt(handle->io_watcher.fd,
|
|
1014
|
+
IPPROTO_IPV6,
|
|
1015
|
+
optname,
|
|
1016
|
+
&mreq,
|
|
1017
|
+
sizeof(mreq))) {
|
|
1018
|
+
return UV__ERR(errno);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
return 0;
|
|
1022
|
+
}
|
|
1023
|
+
#endif
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
int uv__udp_init_ex(uv_loop_t* loop,
|
|
1027
|
+
uv_udp_t* handle,
|
|
1028
|
+
unsigned flags,
|
|
1029
|
+
int domain) {
|
|
1030
|
+
int fd;
|
|
1031
|
+
|
|
1032
|
+
fd = -1;
|
|
1033
|
+
if (domain != AF_UNSPEC) {
|
|
1034
|
+
fd = uv__socket(domain, SOCK_DGRAM, 0);
|
|
1035
|
+
if (fd < 0)
|
|
1036
|
+
return fd;
|
|
580
1037
|
}
|
|
581
1038
|
|
|
582
1039
|
uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP);
|
|
@@ -585,14 +1042,19 @@ int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) {
|
|
|
585
1042
|
handle->send_queue_size = 0;
|
|
586
1043
|
handle->send_queue_count = 0;
|
|
587
1044
|
uv__io_init(&handle->io_watcher, uv__udp_io, fd);
|
|
588
|
-
|
|
589
|
-
|
|
1045
|
+
uv__queue_init(&handle->write_queue);
|
|
1046
|
+
uv__queue_init(&handle->write_completed_queue);
|
|
1047
|
+
|
|
590
1048
|
return 0;
|
|
591
1049
|
}
|
|
592
1050
|
|
|
593
1051
|
|
|
594
|
-
int
|
|
595
|
-
|
|
1052
|
+
int uv_udp_using_recvmmsg(const uv_udp_t* handle) {
|
|
1053
|
+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
|
1054
|
+
if (handle->flags & UV_HANDLE_UDP_RECVMMSG)
|
|
1055
|
+
return 1;
|
|
1056
|
+
#endif
|
|
1057
|
+
return 0;
|
|
596
1058
|
}
|
|
597
1059
|
|
|
598
1060
|
|
|
@@ -601,17 +1063,23 @@ int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) {
|
|
|
601
1063
|
|
|
602
1064
|
/* Check for already active socket. */
|
|
603
1065
|
if (handle->io_watcher.fd != -1)
|
|
604
|
-
return
|
|
1066
|
+
return UV_EBUSY;
|
|
1067
|
+
|
|
1068
|
+
if (uv__fd_exists(handle->loop, sock))
|
|
1069
|
+
return UV_EEXIST;
|
|
605
1070
|
|
|
606
1071
|
err = uv__nonblock(sock, 1);
|
|
607
1072
|
if (err)
|
|
608
1073
|
return err;
|
|
609
1074
|
|
|
610
|
-
err =
|
|
1075
|
+
err = uv__sock_reuseaddr(sock);
|
|
611
1076
|
if (err)
|
|
612
1077
|
return err;
|
|
613
1078
|
|
|
614
1079
|
handle->io_watcher.fd = sock;
|
|
1080
|
+
if (uv__udp_is_connected(handle))
|
|
1081
|
+
handle->flags |= UV_HANDLE_UDP_CONNECTED;
|
|
1082
|
+
|
|
615
1083
|
return 0;
|
|
616
1084
|
}
|
|
617
1085
|
|
|
@@ -635,15 +1103,60 @@ int uv_udp_set_membership(uv_udp_t* handle,
|
|
|
635
1103
|
return err;
|
|
636
1104
|
return uv__udp_set_membership6(handle, &addr6, interface_addr, membership);
|
|
637
1105
|
} else {
|
|
638
|
-
return
|
|
1106
|
+
return UV_EINVAL;
|
|
639
1107
|
}
|
|
640
1108
|
}
|
|
641
1109
|
|
|
1110
|
+
|
|
1111
|
+
int uv_udp_set_source_membership(uv_udp_t* handle,
|
|
1112
|
+
const char* multicast_addr,
|
|
1113
|
+
const char* interface_addr,
|
|
1114
|
+
const char* source_addr,
|
|
1115
|
+
uv_membership membership) {
|
|
1116
|
+
#if !defined(__OpenBSD__) && \
|
|
1117
|
+
!defined(__NetBSD__) && \
|
|
1118
|
+
!defined(__ANDROID__) && \
|
|
1119
|
+
!defined(__DragonFly__) && \
|
|
1120
|
+
!defined(__QNX__) && \
|
|
1121
|
+
!defined(__GNU__)
|
|
1122
|
+
int err;
|
|
1123
|
+
union uv__sockaddr mcast_addr;
|
|
1124
|
+
union uv__sockaddr src_addr;
|
|
1125
|
+
|
|
1126
|
+
err = uv_ip4_addr(multicast_addr, 0, &mcast_addr.in);
|
|
1127
|
+
if (err) {
|
|
1128
|
+
err = uv_ip6_addr(multicast_addr, 0, &mcast_addr.in6);
|
|
1129
|
+
if (err)
|
|
1130
|
+
return err;
|
|
1131
|
+
err = uv_ip6_addr(source_addr, 0, &src_addr.in6);
|
|
1132
|
+
if (err)
|
|
1133
|
+
return err;
|
|
1134
|
+
return uv__udp_set_source_membership6(handle,
|
|
1135
|
+
&mcast_addr.in6,
|
|
1136
|
+
interface_addr,
|
|
1137
|
+
&src_addr.in6,
|
|
1138
|
+
membership);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
err = uv_ip4_addr(source_addr, 0, &src_addr.in);
|
|
1142
|
+
if (err)
|
|
1143
|
+
return err;
|
|
1144
|
+
return uv__udp_set_source_membership4(handle,
|
|
1145
|
+
&mcast_addr.in,
|
|
1146
|
+
interface_addr,
|
|
1147
|
+
&src_addr.in,
|
|
1148
|
+
membership);
|
|
1149
|
+
#else
|
|
1150
|
+
return UV_ENOSYS;
|
|
1151
|
+
#endif
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
|
|
642
1155
|
static int uv__setsockopt(uv_udp_t* handle,
|
|
643
1156
|
int option4,
|
|
644
1157
|
int option6,
|
|
645
1158
|
const void* val,
|
|
646
|
-
|
|
1159
|
+
socklen_t size) {
|
|
647
1160
|
int r;
|
|
648
1161
|
|
|
649
1162
|
if (handle->flags & UV_HANDLE_IPV6)
|
|
@@ -659,7 +1172,7 @@ static int uv__setsockopt(uv_udp_t* handle,
|
|
|
659
1172
|
val,
|
|
660
1173
|
size);
|
|
661
1174
|
if (r)
|
|
662
|
-
return
|
|
1175
|
+
return UV__ERR(errno);
|
|
663
1176
|
|
|
664
1177
|
return 0;
|
|
665
1178
|
}
|
|
@@ -668,7 +1181,7 @@ static int uv__setsockopt_maybe_char(uv_udp_t* handle,
|
|
|
668
1181
|
int option4,
|
|
669
1182
|
int option6,
|
|
670
1183
|
int val) {
|
|
671
|
-
#if defined(__sun) || defined(_AIX)
|
|
1184
|
+
#if defined(__sun) || defined(_AIX) || defined(__MVS__)
|
|
672
1185
|
char arg = val;
|
|
673
1186
|
#elif defined(__OpenBSD__)
|
|
674
1187
|
unsigned char arg = val;
|
|
@@ -677,7 +1190,7 @@ static int uv__setsockopt_maybe_char(uv_udp_t* handle,
|
|
|
677
1190
|
#endif
|
|
678
1191
|
|
|
679
1192
|
if (val < 0 || val > 255)
|
|
680
|
-
return
|
|
1193
|
+
return UV_EINVAL;
|
|
681
1194
|
|
|
682
1195
|
return uv__setsockopt(handle, option4, option6, &arg, sizeof(arg));
|
|
683
1196
|
}
|
|
@@ -689,7 +1202,7 @@ int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
|
|
|
689
1202
|
SO_BROADCAST,
|
|
690
1203
|
&on,
|
|
691
1204
|
sizeof(on))) {
|
|
692
|
-
return
|
|
1205
|
+
return UV__ERR(errno);
|
|
693
1206
|
}
|
|
694
1207
|
|
|
695
1208
|
return 0;
|
|
@@ -698,7 +1211,12 @@ int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
|
|
|
698
1211
|
|
|
699
1212
|
int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
|
|
700
1213
|
if (ttl < 1 || ttl > 255)
|
|
701
|
-
return
|
|
1214
|
+
return UV_EINVAL;
|
|
1215
|
+
|
|
1216
|
+
#if defined(__MVS__)
|
|
1217
|
+
if (!(handle->flags & UV_HANDLE_IPV6))
|
|
1218
|
+
return UV_ENOTSUP; /* zOS does not support setting ttl for IPv4 */
|
|
1219
|
+
#endif
|
|
702
1220
|
|
|
703
1221
|
/*
|
|
704
1222
|
* On Solaris and derivatives such as SmartOS, the length of socket options
|
|
@@ -706,18 +1224,25 @@ int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
|
|
|
706
1224
|
* so hardcode the size of these options on this platform,
|
|
707
1225
|
* and use the general uv__setsockopt_maybe_char call on other platforms.
|
|
708
1226
|
*/
|
|
709
|
-
#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__)
|
|
1227
|
+
#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
|
|
1228
|
+
defined(__MVS__) || defined(__QNX__)
|
|
1229
|
+
|
|
710
1230
|
return uv__setsockopt(handle,
|
|
711
1231
|
IP_TTL,
|
|
712
1232
|
IPV6_UNICAST_HOPS,
|
|
713
1233
|
&ttl,
|
|
714
1234
|
sizeof(ttl));
|
|
715
|
-
|
|
1235
|
+
|
|
1236
|
+
#else /* !(defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
|
|
1237
|
+
defined(__MVS__) || defined(__QNX__)) */
|
|
716
1238
|
|
|
717
1239
|
return uv__setsockopt_maybe_char(handle,
|
|
718
1240
|
IP_TTL,
|
|
719
1241
|
IPV6_UNICAST_HOPS,
|
|
720
1242
|
ttl);
|
|
1243
|
+
|
|
1244
|
+
#endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
|
|
1245
|
+
defined(__MVS__) || defined(__QNX__) */
|
|
721
1246
|
}
|
|
722
1247
|
|
|
723
1248
|
|
|
@@ -728,14 +1253,16 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
|
|
|
728
1253
|
* IP_MULTICAST_TTL, so hardcode the size of the option in the IPv6 case,
|
|
729
1254
|
* and use the general uv__setsockopt_maybe_char call otherwise.
|
|
730
1255
|
*/
|
|
731
|
-
#if defined(__sun) || defined(_AIX)
|
|
1256
|
+
#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
|
|
1257
|
+
defined(__MVS__) || defined(__QNX__)
|
|
732
1258
|
if (handle->flags & UV_HANDLE_IPV6)
|
|
733
1259
|
return uv__setsockopt(handle,
|
|
734
1260
|
IP_MULTICAST_TTL,
|
|
735
1261
|
IPV6_MULTICAST_HOPS,
|
|
736
1262
|
&ttl,
|
|
737
1263
|
sizeof(ttl));
|
|
738
|
-
#endif /* defined(__sun) || defined(_AIX)
|
|
1264
|
+
#endif /* defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
|
|
1265
|
+
defined(__MVS__) || defined(__QNX__) */
|
|
739
1266
|
|
|
740
1267
|
return uv__setsockopt_maybe_char(handle,
|
|
741
1268
|
IP_MULTICAST_TTL,
|
|
@@ -751,14 +1278,16 @@ int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) {
|
|
|
751
1278
|
* IP_MULTICAST_LOOP, so hardcode the size of the option in the IPv6 case,
|
|
752
1279
|
* and use the general uv__setsockopt_maybe_char call otherwise.
|
|
753
1280
|
*/
|
|
754
|
-
#if defined(__sun) || defined(_AIX)
|
|
1281
|
+
#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
|
|
1282
|
+
defined(__MVS__) || defined(__QNX__)
|
|
755
1283
|
if (handle->flags & UV_HANDLE_IPV6)
|
|
756
1284
|
return uv__setsockopt(handle,
|
|
757
1285
|
IP_MULTICAST_LOOP,
|
|
758
1286
|
IPV6_MULTICAST_LOOP,
|
|
759
1287
|
&on,
|
|
760
1288
|
sizeof(on));
|
|
761
|
-
#endif /* defined(__sun) || defined(_AIX)
|
|
1289
|
+
#endif /* defined(__sun) || defined(_AIX) ||defined(__OpenBSD__) ||
|
|
1290
|
+
defined(__MVS__) || defined(__QNX__) */
|
|
762
1291
|
|
|
763
1292
|
return uv__setsockopt_maybe_char(handle,
|
|
764
1293
|
IP_MULTICAST_LOOP,
|
|
@@ -788,7 +1317,7 @@ int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr)
|
|
|
788
1317
|
} else if (uv_ip6_addr(interface_addr, 0, addr6) == 0) {
|
|
789
1318
|
/* nothing, address was parsed */
|
|
790
1319
|
} else {
|
|
791
|
-
return
|
|
1320
|
+
return UV_EINVAL;
|
|
792
1321
|
}
|
|
793
1322
|
|
|
794
1323
|
if (addr_st.ss_family == AF_INET) {
|
|
@@ -797,7 +1326,7 @@ int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr)
|
|
|
797
1326
|
IP_MULTICAST_IF,
|
|
798
1327
|
(void*) &addr4->sin_addr,
|
|
799
1328
|
sizeof(addr4->sin_addr)) == -1) {
|
|
800
|
-
return
|
|
1329
|
+
return UV__ERR(errno);
|
|
801
1330
|
}
|
|
802
1331
|
} else if (addr_st.ss_family == AF_INET6) {
|
|
803
1332
|
if (setsockopt(handle->io_watcher.fd,
|
|
@@ -805,7 +1334,7 @@ int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr)
|
|
|
805
1334
|
IPV6_MULTICAST_IF,
|
|
806
1335
|
&addr6->sin6_scope_id,
|
|
807
1336
|
sizeof(addr6->sin6_scope_id)) == -1) {
|
|
808
|
-
return
|
|
1337
|
+
return UV__ERR(errno);
|
|
809
1338
|
}
|
|
810
1339
|
} else {
|
|
811
1340
|
assert(0 && "unexpected address family");
|
|
@@ -815,23 +1344,24 @@ int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr)
|
|
|
815
1344
|
return 0;
|
|
816
1345
|
}
|
|
817
1346
|
|
|
818
|
-
|
|
819
|
-
int uv_udp_getsockname(const uv_udp_t* handle,
|
|
1347
|
+
int uv_udp_getpeername(const uv_udp_t* handle,
|
|
820
1348
|
struct sockaddr* name,
|
|
821
1349
|
int* namelen) {
|
|
822
|
-
socklen_t socklen;
|
|
823
|
-
|
|
824
|
-
if (handle->io_watcher.fd == -1)
|
|
825
|
-
return -EINVAL; /* FIXME(bnoordhuis) -EBADF */
|
|
826
1350
|
|
|
827
|
-
|
|
828
|
-
|
|
1351
|
+
return uv__getsockpeername((const uv_handle_t*) handle,
|
|
1352
|
+
getpeername,
|
|
1353
|
+
name,
|
|
1354
|
+
namelen);
|
|
1355
|
+
}
|
|
829
1356
|
|
|
830
|
-
|
|
831
|
-
|
|
1357
|
+
int uv_udp_getsockname(const uv_udp_t* handle,
|
|
1358
|
+
struct sockaddr* name,
|
|
1359
|
+
int* namelen) {
|
|
832
1360
|
|
|
833
|
-
|
|
834
|
-
|
|
1361
|
+
return uv__getsockpeername((const uv_handle_t*) handle,
|
|
1362
|
+
getsockname,
|
|
1363
|
+
name,
|
|
1364
|
+
namelen);
|
|
835
1365
|
}
|
|
836
1366
|
|
|
837
1367
|
|
|
@@ -841,10 +1371,10 @@ int uv__udp_recv_start(uv_udp_t* handle,
|
|
|
841
1371
|
int err;
|
|
842
1372
|
|
|
843
1373
|
if (alloc_cb == NULL || recv_cb == NULL)
|
|
844
|
-
return
|
|
1374
|
+
return UV_EINVAL;
|
|
845
1375
|
|
|
846
|
-
if (uv__io_active(&handle->io_watcher,
|
|
847
|
-
return
|
|
1376
|
+
if (uv__io_active(&handle->io_watcher, POLLIN))
|
|
1377
|
+
return UV_EALREADY; /* FIXME(bnoordhuis) Should be UV_EBUSY. */
|
|
848
1378
|
|
|
849
1379
|
err = uv__udp_maybe_deferred_bind(handle, AF_INET, 0);
|
|
850
1380
|
if (err)
|
|
@@ -853,7 +1383,7 @@ int uv__udp_recv_start(uv_udp_t* handle,
|
|
|
853
1383
|
handle->alloc_cb = alloc_cb;
|
|
854
1384
|
handle->recv_cb = recv_cb;
|
|
855
1385
|
|
|
856
|
-
uv__io_start(handle->loop, &handle->io_watcher,
|
|
1386
|
+
uv__io_start(handle->loop, &handle->io_watcher, POLLIN);
|
|
857
1387
|
uv__handle_start(handle);
|
|
858
1388
|
|
|
859
1389
|
return 0;
|
|
@@ -861,9 +1391,9 @@ int uv__udp_recv_start(uv_udp_t* handle,
|
|
|
861
1391
|
|
|
862
1392
|
|
|
863
1393
|
int uv__udp_recv_stop(uv_udp_t* handle) {
|
|
864
|
-
uv__io_stop(handle->loop, &handle->io_watcher,
|
|
1394
|
+
uv__io_stop(handle->loop, &handle->io_watcher, POLLIN);
|
|
865
1395
|
|
|
866
|
-
if (!uv__io_active(&handle->io_watcher,
|
|
1396
|
+
if (!uv__io_active(&handle->io_watcher, POLLOUT))
|
|
867
1397
|
uv__handle_stop(handle);
|
|
868
1398
|
|
|
869
1399
|
handle->alloc_cb = NULL;
|