init.cpp 595 B

1234567891011121314151617181920212223242526272829
  1. #include "init.h"
  2. #include <util/system/defaults.h>
  3. #include <util/generic/singleton.h>
  4. namespace {
  5. class TNetworkInit {
  6. public:
  7. inline TNetworkInit() {
  8. #ifndef ROBOT_SIGPIPE
  9. signal(SIGPIPE, SIG_IGN);
  10. #endif
  11. #if defined(_win_)
  12. #pragma comment(lib, "ws2_32.lib")
  13. WSADATA wsaData;
  14. int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
  15. Y_ASSERT(!result);
  16. if (result) {
  17. exit(-1);
  18. }
  19. #endif
  20. }
  21. };
  22. } // namespace
  23. void InitNetworkSubSystem() {
  24. (void)Singleton<TNetworkInit>();
  25. }