aboutsummaryrefslogtreecommitdiff
path: root/src/Socket.cpp
blob: a078cab9f430f539d2b3239e4600cabc8d537965 (plain)
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
35
36
37
38
39
40
#include "../include/sibs/Socket.hpp"
#include <udt/udt.h>

namespace sibs
{
    Socket::Socket() : 
        eid(-1),
        udtSocket(-1)
    {

    }

    Socket::Socket(int _udtSocket) : 
        eid(-1),
        udtSocket(_udtSocket)
    {

    }

    Socket::Socket(int _eid, int _udtSocket) : 
        eid(_eid),
        udtSocket(_udtSocket)
    {

    }

    Socket::Socket(Socket &&other)
    {
        eid = other.eid;
        udtSocket = other.udtSocket;
        other.eid = -1;
        other.udtSocket = -1;
    }

    Socket::~Socket()
    {
        UDT::epoll_remove_usock(eid, udtSocket);
        UDT::close(udtSocket);
    }
}