Commit 62b61711 authored by zhujiashun's avatar zhujiashun Committed by gejun

* Fix OnDestroyingStream not calling bug

* Fix socket failed bug in rtmp in connection short case
parent 1578278f
......@@ -258,7 +258,6 @@ void Controller::InternalReset(bool in_constructor) {
Controller::Call::Call(Controller::Call* rhs)
: nretry(rhs->nretry)
, need_feedback(rhs->need_feedback)
, touched_by_stream_creator(rhs->touched_by_stream_creator)
, peer_id(rhs->peer_id)
, begin_time_us(rhs->begin_time_us)
, sending_sock(rhs->sending_sock.release()) {
......@@ -266,7 +265,6 @@ Controller::Call::Call(Controller::Call* rhs)
// setting all the fields to next call and _current_call.OnComplete
// will behave incorrectly.
rhs->need_feedback = false;
rhs->touched_by_stream_creator = false;
rhs->peer_id = (SocketId)-1;
}
......@@ -733,7 +731,7 @@ void Controller::Call::OnComplete(
case CONNECTION_TYPE_SHORT:
if (sending_sock != NULL) {
// Check the comment in CONNECTION_TYPE_POOLED branch.
if (!sending_sock->is_read_progressive()) {
if (!sending_sock->is_read_progressive() && c->_stream_creator == NULL) {
sending_sock->SetFailed();
} else {
sending_sock->OnProgressiveReadCompleted();
......@@ -769,9 +767,7 @@ void Controller::Call::OnComplete(
c->_lb->Feedback(info);
}
if (touched_by_stream_creator) {
touched_by_stream_creator = false;
CHECK(c->stream_creator());
if (c->stream_creator()) {
c->stream_creator()->OnDestroyingStream(
sending_sock, c, error_code, end_of_rpc);
}
......@@ -1000,7 +996,6 @@ void Controller::IssueRPC(int64_t start_realtime_us) {
_remote_side = tmp_sock->remote_side();
}
if (_stream_creator) {
_current_call.touched_by_stream_creator = true;
_stream_creator->OnCreatingStream(&tmp_sock, this);
if (FailedInline()) {
return HandleSendFailed();
......
......@@ -29,7 +29,9 @@ class Controller;
class StreamCreator {
public:
// Called when the socket for sending request is about to be created.
// If the RPC has retries, this function is called before each retry.
// If the RPC has retries, this function MAY be called before each retry.
// This function would not be called if some preconditions are not
// satisfied.
// Params:
// inout: pointing to the socket to send requests by default,
// replaceable by user created ones (or keep as it is). remote_side()
......@@ -43,8 +45,7 @@ public:
Controller* cntl) = 0;
// Called when the stream is about to destroyed.
// If the RPC has retries, this function is called before each retry.
// This method is always called even if OnCreatingStream() is not called.
// If the RPC has retries, this function MUST be called before each retry.
// Params:
// sending_sock: The socket chosen by OnCreatingStream(), if OnCreatingStream
// is not called, the enclosed socket may be NULL.
......
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