-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathlocal.h
40 lines (34 loc) · 904 Bytes
/
local.h
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
#ifndef KCPTUN_LOCAL_H
#define KCPTUN_LOCAL_H
#include "config.h"
#include "sess.h"
class smux_sess;
class smux;
class Local final :
public std::enable_shared_from_this<Local>,
public kvar_,
public Destroy {
public:
Local(asio::io_service &io_service, asio::ip::udp::endpoint ep);
void run();
void async_connect(std::function<void(std::shared_ptr<smux_sess>)> handler);
void run_scavenger();
private:
void do_usocket_receive();
void do_sess_receive();
void call_this_on_destroy() override;
private:
char buf_[2048];
char sbuf_[2048];
asio::io_service &service_;
asio::ip::udp::endpoint ep_;
std::shared_ptr<Session> sess_;
std::shared_ptr<smux> smux_;
std::shared_ptr<AsyncReadWriter> usock_;
OutputHandler in;
OutputHandler out;
OutputHandler in2;
OutputHandler out2;
Buffers buffers_;
};
#endif