aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/init.cpp
blob: d9fff7d6a7ca096aa7cb8324af51304ede39a044 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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>(); 
}