diff --git a/a8/ioloop.cc b/a8/ioloop.cc index 7e7c1ec..a251f91 100644 --- a/a8/ioloop.cc +++ b/a8/ioloop.cc @@ -12,19 +12,22 @@ #include -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() + { + } } diff --git a/a8/tcpclient2.cc b/a8/tcpclient2.cc index 1342e38..550b104 100644 --- a/a8/tcpclient2.cc +++ b/a8/tcpclient2.cc @@ -51,7 +51,7 @@ namespace a8 bool TcpClient2::IsActive() { - return socket__ != a8::INVALID_SOCKET; + return socket_ != a8::INVALID_SOCKET; } bool TcpClient2::Connected() diff --git a/a8/tcpclient2.h b/a8/tcpclient2.h index 783b9cf..4a91ab2 100644 --- a/a8/tcpclient2.h +++ b/a8/tcpclient2.h @@ -6,15 +6,15 @@ namespace a8 class TcpClient2 { public: - std::function on_error; - std::function on_connect; - std::function on_disconnect; - std::function on_socketread; + std::function on_error; + std::function on_connect; + std::function on_disconnect; + std::function 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(); }; }