This commit is contained in:
aozhiwei 2020-05-11 13:50:46 +08:00
parent ae45a76bba
commit 60a1b6445a
5 changed files with 16 additions and 11 deletions

View File

@ -23,16 +23,11 @@ IMConn* IMConnMgr::GetConnByKey(const std::string& key)
return itr != key_hash_.end() ? itr->second : nullptr;
}
IMConn* IMConnMgr::GetConnById(int instance_id)
{
auto itr = id_hash_.find(instance_id);
return itr != id_hash_.end() ? itr->second : nullptr;
}
IMConn* IMConnMgr::RecreateIMConn(const std::string& host, int port)
{
std::string key = host + ":" + a8::XValue(port).GetString();
IMConn* conn = GetConnByKey(key);
#if 0
if (conn) {
return conn;
}
@ -45,6 +40,7 @@ IMConn* IMConnMgr::RecreateIMConn(const std::string& host, int port)
conn->Init(instance_id, remote_ip, remote_port);
id_hash_[conn->instance_id] = conn;
key_hash_[key] = conn;
#endif
conn->Open();
return conn;
}

View File

@ -13,11 +13,9 @@ class IMConnMgr : public a8::Singleton<IMConnMgr>
void UnInit();
IMConn* GetConnByKey(const std::string& key);
IMConn* GetConnById(int instance_id);
IMConn* RecreateIMConn(const std::string& host, int port);
private:
unsigned short curr_id_ = 1000;
std::map<std::string, IMConn*> key_hash_;
std::map<int, IMConn*> id_hash_;
std::map<long long, IMConn*> id_hash_;
};

View File

@ -12,7 +12,6 @@ struct PerfMonitor
long long read_count = 0;
};
struct Friend
{
std::string account_id;
@ -21,6 +20,10 @@ struct Friend
int sex = 0;
int online = 0;
std::string server_host;
int server_port;
long long server_ident = 0;
int data_version1 = 0;
unsigned int crc32_code = 0;
};

View File

@ -153,6 +153,13 @@ message SMGroupRename
optional string error_msg = 2;
}
message CMSendChatMsg
{
optional int32 chat_channel = 1;
optional string target = 2;
optional string msg = 3;
}
message SMUserStatusNotify
{
repeated string online_users = 1;
@ -163,6 +170,7 @@ message SMChatMsgNotify
{
optional string sender = 1;
optional int32 chat_channel = 2;
optional string msg = 3;
}
message SMUserInfoUpdate

@ -1 +1 @@
Subproject commit 9ba2696e52664c9f5b7a1e09a4a5516359d330b0
Subproject commit 4e1a34704dc08d0279e78c275989f10f85fd6cc2