1
This commit is contained in:
parent
a61719966e
commit
ba2151d25c
@ -7,7 +7,6 @@ namespace a8
|
||||
class TcpClient;
|
||||
}
|
||||
|
||||
struct timer_list;
|
||||
class Master
|
||||
{
|
||||
public:
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <a8/a8.h>
|
||||
#include <f8/f8.h>
|
||||
#include <f8/timer.h>
|
||||
|
||||
#include "constant.h"
|
||||
#include "types.h"
|
||||
|
@ -34,15 +34,15 @@ void UpStream::Init(int instance_id, const std::string& remote_ip, int remote_po
|
||||
tcp_client_->on_connect = std::bind(&UpStream::on_connect, this, std::placeholders::_1);
|
||||
tcp_client_->on_disconnect = std::bind(&UpStream::on_disconnect, this, std::placeholders::_1);
|
||||
tcp_client_->on_socketread = std::bind(&UpStream::on_socketread, this ,std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||
#if 0
|
||||
timer_ = a8::Timer::Instance()->AddRepeatTimer(1000 * 9 + a8::RandEx(500, 150),
|
||||
a8::XParams().SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
UpStream* conn = (UpStream*)param.sender.GetUserData();
|
||||
conn->CheckAlive();
|
||||
});
|
||||
#endif
|
||||
timer_wp_ = f8::Timer::Instance()->SetIntervalWpEx
|
||||
(1000 * 9 + a8::RandEx(500, 150),
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
CheckAlive();
|
||||
}
|
||||
},
|
||||
&attacher_);
|
||||
}
|
||||
|
||||
void UpStream::UnInit()
|
||||
|
@ -17,7 +17,6 @@ struct UpStreamMsgNode
|
||||
UpStreamMsgNode* next_node = nullptr;
|
||||
};
|
||||
|
||||
struct timer_list;
|
||||
class UpStream
|
||||
{
|
||||
public:
|
||||
@ -68,7 +67,8 @@ class UpStream
|
||||
char *recv_buff_ = nullptr;
|
||||
unsigned int recv_bufflen_ = 0;
|
||||
std::shared_ptr<a8::TcpClient> tcp_client_;
|
||||
timer_list* timer_ = nullptr;
|
||||
f8::TimerWp timer_wp_;
|
||||
f8::Attacher attacher_;
|
||||
|
||||
UpStreamMsgNode* top_node_ = nullptr;
|
||||
UpStreamMsgNode* bot_node_ = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user