1
This commit is contained in:
parent
48295756bf
commit
9394d487c0
@ -16,6 +16,7 @@
|
|||||||
#include "master.h"
|
#include "master.h"
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "iomgr.h"
|
||||||
|
|
||||||
const int PACK_MAX = 1024 * 64;
|
const int PACK_MAX = 1024 * 64;
|
||||||
|
|
||||||
@ -29,7 +30,11 @@ void Master::Init(int instance_id, const std::string& remote_ip, int remote_port
|
|||||||
last_pong_tick = a8::XGetTickCount();
|
last_pong_tick = a8::XGetTickCount();
|
||||||
recv_buff_ = (char*) malloc(PACK_MAX * 2);
|
recv_buff_ = (char*) malloc(PACK_MAX * 2);
|
||||||
#ifdef USE_ASIO
|
#ifdef USE_ASIO
|
||||||
tcp_client_ = std::make_shared<a8::AsioTcpClient>(remote_ip, remote_port);
|
auto io_context = IoMgr::Instance()->GetIoContext(IC_Master);
|
||||||
|
if (!io_context) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
tcp_client_ = std::make_shared<a8::AsioTcpClient>(*io_context, remote_ip, remote_port);
|
||||||
#else
|
#else
|
||||||
tcp_client_ = std::make_shared<a8::TcpClient>(remote_ip, remote_port);
|
tcp_client_ = std::make_shared<a8::TcpClient>(remote_ip, remote_port);
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "upstream.h"
|
#include "upstream.h"
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "iomgr.h"
|
||||||
|
|
||||||
const int PACK_MAX = 1024 * 64 * 2;
|
const int PACK_MAX = 1024 * 64 * 2;
|
||||||
|
|
||||||
@ -33,7 +34,11 @@ void UpStream::Init(int instance_id, const std::string& remote_ip, int remote_po
|
|||||||
last_pong_tick = a8::XGetTickCount();
|
last_pong_tick = a8::XGetTickCount();
|
||||||
recv_buff_ = (char*) malloc(PACK_MAX * 2);
|
recv_buff_ = (char*) malloc(PACK_MAX * 2);
|
||||||
#ifdef USE_ASIO
|
#ifdef USE_ASIO
|
||||||
tcp_client_ = std::make_shared<a8::AsioTcpClient>(remote_ip, remote_port);
|
auto io_context = IoMgr::Instance()->GetIoContext(IC_Master);
|
||||||
|
if (!io_context) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
tcp_client_ = std::make_shared<a8::AsioTcpClient>(*io_context, remote_ip, remote_port);
|
||||||
#else
|
#else
|
||||||
tcp_client_ = std::make_shared<a8::TcpClient>(remote_ip, remote_port);
|
tcp_client_ = std::make_shared<a8::TcpClient>(remote_ip, remote_port);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user