1
This commit is contained in:
parent
0c1f08b877
commit
0ddb1e12ef
@ -5,6 +5,17 @@
|
||||
|
||||
#include "ss_proto.pb.h"
|
||||
|
||||
void DownStream::Init(int socket_handle, std::weak_ptr<UpStream> up)
|
||||
{
|
||||
socket_handle_ = socket_handle;
|
||||
up_ = up;
|
||||
}
|
||||
|
||||
void DownStream::ReBindUpStream(std::weak_ptr<UpStream> up)
|
||||
{
|
||||
up_ = up;
|
||||
}
|
||||
|
||||
void DownStream::ForwardUpStreamMsg(f8::MsgHdr& hdr)
|
||||
{
|
||||
|
||||
|
@ -5,10 +5,11 @@ class DownStream
|
||||
{
|
||||
public:
|
||||
|
||||
int GetSocketHandle() { return socket_handle_; }
|
||||
void SetSocketHandle(int socket_handle) { socket_handle_ = socket_handle; }
|
||||
std::weak_ptr<UpStream> GetUpStream() { return up_; }
|
||||
void SetUpStream(std::weak_ptr<UpStream> up) { up_ = up; }
|
||||
void Init(int socket_handle, std::weak_ptr<UpStream> up);
|
||||
|
||||
int GetSocketHandle() const { return socket_handle_; }
|
||||
std::weak_ptr<UpStream> GetUpStream() const { return up_; }
|
||||
void ReBindUpStream(std::weak_ptr<UpStream> up);
|
||||
|
||||
void ForwardUpStreamMsg(f8::MsgHdr& hdr);
|
||||
void OnClose();
|
||||
|
@ -83,11 +83,10 @@ void DownStreamMgr::BindUpStream(int socket_handle, int conn_instance_id)
|
||||
if (!up_wp.expired()) {
|
||||
auto down_wp = GetDownStream(socket_handle);
|
||||
if (auto down = down_wp.lock(); !down_wp.expired()) {
|
||||
down->SetUpStream(up_wp);
|
||||
down->ReBindUpStream(up_wp);
|
||||
} else {
|
||||
down = std::make_shared<DownStream>();
|
||||
down->SetSocketHandle(socket_handle);
|
||||
down->SetUpStream(up_wp);
|
||||
down->Init(socket_handle, up_wp);
|
||||
socket_hash_[down->GetSocketHandle()] = down;
|
||||
f8::UdpLog::Instance()->Info("BindUpStream socket_handle:%d",
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user