Commit 44c49447 authored by zhujiashun's avatar zhujiashun

Refine interface of DestroyStreamUserData

parent d174847b
......@@ -697,7 +697,7 @@ inline bool does_error_affect_main_socket(int error_code) {
void Controller::Call::OnComplete(
Controller* c, int error_code/*note*/, bool responded, bool end_of_rpc) {
if (stream_user_data) {
stream_user_data->DestroyStreamUserData(sending_sock, c, error_code, end_of_rpc);
stream_user_data->DestroyStreamUserData(sending_sock, error_code, end_of_rpc);
stream_user_data = NULL;
}
......
......@@ -1448,12 +1448,10 @@ private:
};
void H2UnsentRequest::DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code,
bool /*end_of_rpc*/) {
RemoveRefOnQuit deref_self(this);
if (sending_sock != NULL && (cntl->ErrorCode() != 0 || error_code != 0)) {
CHECK_EQ(cntl, _cntl);
if (sending_sock != NULL && error_code != 0) {
std::unique_lock<butil::Mutex> mu(_mutex);
_cntl = NULL;
if (_stream_id != 0) {
......
......@@ -153,7 +153,6 @@ public:
// @StreamUserData
void DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code,
bool end_of_rpc) override;
......
......@@ -1747,7 +1747,6 @@ void RtmpClientStream::OnFailedToCreateStream() {
}
void RtmpClientStream::DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int /*error_code*/,
bool end_of_rpc) {
if (!end_of_rpc) {
......
......@@ -827,7 +827,6 @@ friend class RtmpRetryingClientStream;
// @StreamUserData
void DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code,
bool end_of_rpc) override;
......
......@@ -66,11 +66,9 @@ public:
// Params:
// sending_sock: The socket chosen by OnCreatingStream(), if an error
// happens during choosing, the enclosed socket is NULL.
// cntl: contexts of the RPC
// error_code: Use this instead of cntl->ErrorCode()
// error_code: the error code after the RPC.
// end_of_rpc: true if the RPC is about to destroyed.
virtual void DestroyStreamUserData(SocketUniquePtr& sending_sock,
Controller* cntl,
int error_code,
bool end_of_rpc) = 0;
};
......
......@@ -1113,7 +1113,7 @@ TEST_F(HttpTest, http2_window_used_up) {
} else {
ASSERT_TRUE(st.ok());
}
h2_req->DestroyStreamUserData(_h2_client_sock, &cntl, 0, false);
h2_req->DestroyStreamUserData(_h2_client_sock, 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