Skip to content

Commit

Permalink
tweak messenger error path
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Nov 13, 2024
1 parent 8c11e30 commit edf4121
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ SEXP rnng_messenger(SEXP url) {
SEXP socket, con;

if ((xc = nng_pair0_open(sock)))
goto fail;
goto exitlevel1;
lp = R_Calloc(1, nng_listener);
if ((xc = nng_listen(*sock, up, lp, 0))) {
if (xc != 10 && xc != 15) {
R_Free(lp);
goto fail;
goto exitlevel2;
}
R_Free(lp);
dp = R_Calloc(1, nng_dialer);
if ((xc = nng_dial(*sock, up, dp, 0))) {
R_Free(dp);
goto fail;
goto exitlevel2;
}
dialer = 1;
}
Expand All @@ -172,7 +172,9 @@ SEXP rnng_messenger(SEXP url) {
UNPROTECT(2);
return socket;

fail:
exitlevel2:
nng_close(*sock);
exitlevel1:
R_Free(sock);
ERROR_OUT(xc);

Expand Down

0 comments on commit edf4121

Please sign in to comment.