Skip to content

Commit

Permalink
Set service session's passive state more precisely. (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim authored Dec 28, 2024
1 parent e18b9b5 commit 75c662c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/kernel/Communicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ void Communicator::handle_incoming_request(struct poller_result *res)
{
case PR_ST_SUCCESS:
session = entry->session;
session->passive = 2;
state = CS_STATE_TOREPLY;
pthread_mutex_lock(&target->mutex);
if (entry->state == CONN_STATE_SUCCESS)
Expand Down Expand Up @@ -648,6 +649,7 @@ void Communicator::handle_incoming_request(struct poller_result *res)
state = CS_STATE_ERROR;
case CONN_STATE_RECEIVING:
session = entry->session;
session->passive = 3;
break;

case CONN_STATE_SUCCESS:
Expand All @@ -664,10 +666,7 @@ void Communicator::handle_incoming_request(struct poller_result *res)
if (entry)
{
if (session)
{
session->passive = 2;
session->handle(state, res->error);
}

if (__sync_sub_and_fetch(&entry->ref, 1) == 0)
{
Expand Down Expand Up @@ -1084,21 +1083,22 @@ void Communicator::handle_recvfrom_result(struct poller_result *res)
target = entry->target;
if (entry->state == CONN_STATE_SUCCESS)
{
session->passive = 2;
state = CS_STATE_TOREPLY;
error = 0;
entry->state = CONN_STATE_IDLE;
list_add(&entry->list, &target->idle_list);
}
else
{
session->passive = 3;
state = CS_STATE_ERROR;
if (entry->state == CONN_STATE_ERROR)
error = entry->error;
else
error = EBADMSG;
}

session->passive = 2;
session->handle(state, error);
if (state == CS_STATE_ERROR)
{
Expand Down

0 comments on commit 75c662c

Please sign in to comment.