diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/network/init.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/network/init.cpp')
-rw-r--r-- | util/network/init.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/util/network/init.cpp b/util/network/init.cpp new file mode 100644 index 0000000000..366e65682c --- /dev/null +++ b/util/network/init.cpp @@ -0,0 +1,34 @@ +#include "init.h" + +#include <util/system/compat.h> +#include <util/system/yassert.h> +#include <util/system/defaults.h> +#include <util/generic/singleton.h> + +#include <cstdio> +#include <cstdlib> + +namespace { + class TNetworkInit { + public: + inline TNetworkInit() { +#ifndef ROBOT_SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif + +#if defined(_win_) + #pragma comment(lib, "ws2_32.lib") + WSADATA wsaData; + int result = WSAStartup(MAKEWORD(2, 2), &wsaData); + Y_ASSERT(!result); + if (result) { + exit(-1); + } +#endif + } + }; +} + +void InitNetworkSubSystem() { + (void)Singleton<TNetworkInit>(); +} |