Skip to content

Commit

Permalink
TRY MORE, +7
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Nov 3, 2024
1 parent f4122ed commit ba8a793
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ static bool
_detach_service_from_connection(natsConnection *nc, microService *m)
{
bool removed = false;
int remaining = 0;

if (nc == NULL || m == NULL)
return false;

printf("<>/<> _detach_service_from_connection\n");
printf("<>/<> _detachING_service_from_connection %s: remaining: %d, removed: %d\n", m->cfg->Name, remaining, removed);
natsConn_Lock(nc);
for (int i = 0; i < nc->numServices; i++)
{
Expand All @@ -299,8 +301,9 @@ _detach_service_from_connection(natsConnection *nc, microService *m)
removed = true;
break;
}
remaining = nc->numServices;
natsConn_Unlock(nc);

printf("<>/<> _detachED_service_from_connection %s: remaining: %d, removed: %d\n", m->cfg->Name, remaining, removed);
return removed;
}

Expand Down Expand Up @@ -404,6 +407,7 @@ void micro_release_endpoint_when_unsubscribed(void *closure)
if ((m == NULL) || (m->service_mu == NULL))
return;

printf("<>/<> SUB complete: service %s, endpoint %s\n", m->cfg->Name, ep->subject);
micro_lock_endpoint(ep);
sub = ep->sub;
ep->sub = NULL; // Force the subscription to be destroyed now, so NULL out the pointer to avoid a double free.
Expand Down

0 comments on commit ba8a793

Please sign in to comment.