-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTCPSocket.h
51 lines (40 loc) · 888 Bytes
/
TCPSocket.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
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "mg/aio/TCPSocketIFace.h"
namespace mg {
namespace aio {
struct TCPSocketParams
{
TCPSocketParams();
// No parameters yet.
};
// Event-oriented asynchronous TCP socket.
class TCPSocket
: public TCPSocketIFace
{
public:
TCPSocket(
IOCore& aCore);
void Open(
const TCPSocketParams& aParams);
private:
~TCPSocket() override = default;
void OnEvent(
const IOArgs& aArgs) override;
void PrivSend();
void PrivSendAbort(
mg::box::Error* aError);
void PrivSendCommit(
uint32_t aByteCount);
bool PrivSendEventConsume();
void PrivRecv();
void PrivRecvAbort(
mg::box::Error* aError);
void PrivRecvCommit(
uint32_t aByteCount);
bool PrivRecvEventConsume();
// Offset in the first buffer for sending. It is > 0 when a whole buffer couldn't
// be sent in one IO operation.
uint32_t mySendOffset;
};
}
}