Skip to content

Commit

Permalink
wip ++++2
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Oct 31, 2024
1 parent c49efdb commit 30bedbb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,19 @@ _stop_service(microService *m, bool unsubscribe)
{
microError *err = NULL;
microEndpoint *ep = NULL;
bool alreadyStopped = false;

if (m == NULL)
return micro_ErrorInvalidArg;

printf("<>/<> microService_Stop %s, unsub %d\n", m->cfg->Name, unsubscribe);
_lock_service(m);
alreadyStopped = m->stopped;
m->stopped = true;
_unlock_service(m);
if (alreadyStopped)
if (m->stopped)
{
_unlock_service(m);
return NULL;
}

m->stopped = true;

if (unsubscribe)
{
Expand All @@ -266,6 +267,7 @@ _stop_service(microService *m, bool unsubscribe)
}
}
}
_unlock_service(m);

natsConn_removeService(m->nc, m);
return NULL;
Expand Down

0 comments on commit 30bedbb

Please sign in to comment.