Commit 0bc3f27c authored by zhujiashun's avatar zhujiashun

Add cntl param back to DestroyStreamUserData

parent 44c49447
...@@ -697,7 +697,7 @@ inline bool does_error_affect_main_socket(int error_code) { ...@@ -697,7 +697,7 @@ inline bool does_error_affect_main_socket(int error_code) {
void Controller::Call::OnComplete( void Controller::Call::OnComplete(
Controller* c, int error_code/*note*/, bool responded, bool end_of_rpc) { Controller* c, int error_code/*note*/, bool responded, bool end_of_rpc) {
if (stream_user_data) { if (stream_user_data) {
stream_user_data->DestroyStreamUserData(sending_sock, error_code, end_of_rpc); stream_user_data->DestroyStreamUserData(sending_sock, c, error_code, end_of_rpc);
stream_user_data = NULL; stream_user_data = NULL;
} }
......
...@@ -1448,10 +1448,12 @@ private: ...@@ -1448,10 +1448,12 @@ private:
}; };
void H2UnsentRequest::DestroyStreamUserData(SocketUniquePtr& sending_sock, void H2UnsentRequest::DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code, int error_code,
bool /*end_of_rpc*/) { bool /*end_of_rpc*/) {
RemoveRefOnQuit deref_self(this); RemoveRefOnQuit deref_self(this);
if (sending_sock != NULL && error_code != 0) { if (sending_sock != NULL && error_code != 0) {
CHECK_EQ(cntl, _cntl);
std::unique_lock<butil::Mutex> mu(_mutex); std::unique_lock<butil::Mutex> mu(_mutex);
_cntl = NULL; _cntl = NULL;
if (_stream_id != 0) { if (_stream_id != 0) {
......
...@@ -153,6 +153,7 @@ public: ...@@ -153,6 +153,7 @@ public:
// @StreamUserData // @StreamUserData
void DestroyStreamUserData(SocketUniquePtr& sending_sock, void DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code, int error_code,
bool end_of_rpc) override; bool end_of_rpc) override;
......
...@@ -1747,6 +1747,7 @@ void RtmpClientStream::OnFailedToCreateStream() { ...@@ -1747,6 +1747,7 @@ void RtmpClientStream::OnFailedToCreateStream() {
} }
void RtmpClientStream::DestroyStreamUserData(SocketUniquePtr& sending_sock, void RtmpClientStream::DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int /*error_code*/, int /*error_code*/,
bool end_of_rpc) { bool end_of_rpc) {
if (!end_of_rpc) { if (!end_of_rpc) {
......
...@@ -827,6 +827,7 @@ friend class RtmpRetryingClientStream; ...@@ -827,6 +827,7 @@ friend class RtmpRetryingClientStream;
// @StreamUserData // @StreamUserData
void DestroyStreamUserData(SocketUniquePtr& sending_sock, void DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code, int error_code,
bool end_of_rpc) override; bool end_of_rpc) override;
......
...@@ -66,9 +66,11 @@ public: ...@@ -66,9 +66,11 @@ public:
// Params: // Params:
// sending_sock: The socket chosen by OnCreatingStream(), if an error // sending_sock: The socket chosen by OnCreatingStream(), if an error
// happens during choosing, the enclosed socket is NULL. // happens during choosing, the enclosed socket is NULL.
// error_code: the error code after the RPC. // cntl: contexts of the RPC
// error_code: error code after the RPC.
// end_of_rpc: true if the RPC is about to destroyed. // end_of_rpc: true if the RPC is about to destroyed.
virtual void DestroyStreamUserData(SocketUniquePtr& sending_sock, virtual void DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code, int error_code,
bool end_of_rpc) = 0; bool end_of_rpc) = 0;
}; };
......
...@@ -1113,7 +1113,7 @@ TEST_F(HttpTest, http2_window_used_up) { ...@@ -1113,7 +1113,7 @@ TEST_F(HttpTest, http2_window_used_up) {
} else { } else {
ASSERT_TRUE(st.ok()); ASSERT_TRUE(st.ok());
} }
h2_req->DestroyStreamUserData(_h2_client_sock, 0, false); h2_req->DestroyStreamUserData(_h2_client_sock, &cntl, 0, false);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment