This commit is contained in:
aozhiwei 2019-05-31 15:17:52 +08:00
parent 9759a9f009
commit 70758cada3

View File

@ -3,6 +3,7 @@
#include "target_conn_mgr.h" #include "target_conn_mgr.h"
#include "target_conn.h" #include "target_conn.h"
#include "jsondatamgr.h" #include "jsondatamgr.h"
#include "app.h"
void TargetConnMgr::Init() void TargetConnMgr::Init()
{ {
@ -14,12 +15,18 @@ void TargetConnMgr::Init()
int instance_id = target_server_conf->At("instance_id")->AsXValue(); int instance_id = target_server_conf->At("instance_id")->AsXValue();
std::string remote_ip = target_server_conf->At("ip")->AsXValue(); std::string remote_ip = target_server_conf->At("ip")->AsXValue();
int remote_port = target_server_conf->At("port")->AsXValue(); int remote_port = target_server_conf->At("port")->AsXValue();
if (App::Instance()->HasFlag(3)) {
remote_ip = "127.0.0.1";
}
{ {
TargetConn* conn = new TargetConn(); TargetConn* conn = new TargetConn();
conn->Init(instance_id, remote_ip, remote_port); conn->Init(instance_id, remote_ip, remote_port);
id_hash_[conn->instance_id] = conn; id_hash_[conn->instance_id] = conn;
conn->Open(); conn->Open();
} }
if (App::Instance()->HasFlag(3)) {
break;
}
} }
#endif #endif
} }