Commit 739172ae authored by gejun's avatar gejun

Adjust impl. of OnCompleteAndKeepSocket/OnComplete

parent b7e545c5
......@@ -68,7 +68,6 @@ endif
http_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
ifneq ("$(LINK_SO)", "")
@echo "@$(CXX) $(LIBPATHS) $(SOPATHS) $(LINK_OPTIONS_SO) -o $@"
@$(CXX) $(LIBPATHS) $(SOPATHS) $(LINK_OPTIONS_SO) -o $@
else
@$(CXX) $(LIBPATHS) $(LINK_OPTIONS) -o $@
......
......@@ -694,8 +694,8 @@ inline bool does_error_affect_main_socket(int error_code) {
// retries and backup requests. This method simply cares about the error of
// this very Call (specified by |error_code|) rather than the error of the
// entire RPC (specified by c->FailedInline()).
void Controller::Call::OnComplete(Controller* c, int error_code/*note*/,
bool responded, bool release_socket) {
void Controller::Call::OnCompleteAndKeepSocket(
Controller* c, int error_code/*note*/, bool responded) {
switch (c->connection_type()) {
case CONNECTION_TYPE_UNKNOWN:
break;
......@@ -778,9 +778,11 @@ void Controller::Call::OnComplete(Controller* c, int error_code/*note*/,
}
}
void Controller::Call::OnCompleteAndKeepSocket(
void Controller::Call::OnComplete(
Controller* c, int error_code, bool responded) {
OnComplete(c, error_code, responded, false);
OnCompleteAndKeepSocket(c, error_code, responded);
// Release the `Socket' we used to send/receive data
sending_sock.reset(NULL);
}
void Controller::EndRPC(const CompletionInfo& info) {
......@@ -837,13 +839,14 @@ void Controller::EndRPC(const CompletionInfo& info) {
CHECK(false) << "A previous non-backed-up call responded";
_unfinished_call->OnCompleteAndKeepSocket(this, ECANCELED, false);
}
delete _unfinished_call;
_unfinished_call = NULL;
if (_stream_creator) {
_stream_creator->OnStreamCreationDone(
_unfinished_call->sending_sock, this);
}
_unfinished_call->sending_sock.reset(NULL);
delete _unfinished_call;
_unfinished_call = NULL;
} else {
CHECK(false) << "A previous non-backed-up call responded";
}
......
......@@ -568,7 +568,7 @@ private:
Call(Call*); //move semantics
~Call();
void Reset();
void OnComplete(Controller* c, int error_code, bool responded, bool release_socket = true);
void OnComplete(Controller* c, int error_code, bool responded);
void OnCompleteAndKeepSocket(Controller* c, int error_code, bool responded);
int nretry; // sent in nretry-th retry.
......
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