1
This commit is contained in:
parent
4172aafb0e
commit
8cee06b528
25
a8/ioloop.cc
25
a8/ioloop.cc
@ -12,19 +12,22 @@
|
||||
|
||||
#include <a8/ioloop.h>
|
||||
|
||||
void IoLoop::Init()
|
||||
namespace a8
|
||||
{
|
||||
epoll_fd = ::epoll_create(10000);
|
||||
assert(epoll_fd != a8::INVALID_FD);
|
||||
}
|
||||
void IoLoop::Init()
|
||||
{
|
||||
epoll_fd = ::epoll_create(10000);
|
||||
assert(epoll_fd != a8::INVALID_FD);
|
||||
}
|
||||
|
||||
void IoLoop::UnInit()
|
||||
{
|
||||
::close(epoll_fd);
|
||||
epoll_fd = a8::INVALID_FD;
|
||||
}
|
||||
void IoLoop::UnInit()
|
||||
{
|
||||
::close(epoll_fd);
|
||||
epoll_fd = a8::INVALID_FD;
|
||||
}
|
||||
|
||||
void IoLoop::Update()
|
||||
{
|
||||
void IoLoop::Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace a8
|
||||
|
||||
bool TcpClient2::IsActive()
|
||||
{
|
||||
return socket__ != a8::INVALID_SOCKET;
|
||||
return socket_ != a8::INVALID_SOCKET;
|
||||
}
|
||||
|
||||
bool TcpClient2::Connected()
|
||||
|
@ -6,15 +6,15 @@ namespace a8
|
||||
class TcpClient2
|
||||
{
|
||||
public:
|
||||
std::function<void (a8::TcpClient*, int)> on_error;
|
||||
std::function<void (a8::TcpClient*)> on_connect;
|
||||
std::function<void (a8::TcpClient*)> on_disconnect;
|
||||
std::function<void (a8::TcpClient*, char*, unsigned int)> on_socketread;
|
||||
std::function<void (a8::TcpClient2*, int)> on_error;
|
||||
std::function<void (a8::TcpClient2*)> on_connect;
|
||||
std::function<void (a8::TcpClient2*)> on_disconnect;
|
||||
std::function<void (a8::TcpClient2*, char*, unsigned int)> on_socketread;
|
||||
std::string remote_address;
|
||||
int remote_port = 0;
|
||||
|
||||
TcpClient();
|
||||
virtual ~TcpClient();
|
||||
TcpClient2();
|
||||
virtual ~TcpClient2();
|
||||
|
||||
void Open();
|
||||
void Close();
|
||||
@ -25,6 +25,7 @@ namespace a8
|
||||
private:
|
||||
volatile int socket_ = a8::INVALID_SOCKET;
|
||||
volatile bool connected_ = false;
|
||||
std::mutex* send_buffer_mutex_ = nullptr;
|
||||
SendQueueNode *top_node_ = nullptr;
|
||||
SendQueueNode *bot_node_ = nullptr;
|
||||
std::mutex *send_cond_mutex_ = nullptr;
|
||||
@ -33,6 +34,7 @@ namespace a8
|
||||
void SetActive(bool active);
|
||||
bool ActiveStart();
|
||||
void ActiveStop();
|
||||
void NotifySendCond();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user