Skip to content

Commit

Permalink
listener no longer needs to parse the url
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jan 21, 2025
1 parent e36cc64 commit 63792bd
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ SEXP rnng_dial(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
if (NANO_TAG(socket) != nano_SocketSymbol)
Rf_error("'socket' is not a valid Socket");

const uint8_t sec = tls != R_NilValue;
const int sec = tls != R_NilValue;

if (sec && NANO_TAG(tls) != nano_TlsSymbol)
Rf_error("'tls' is not a valid TLS Configuration");
Expand Down Expand Up @@ -178,7 +178,7 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
if (NANO_TAG(socket) != nano_SocketSymbol)
Rf_error("'socket' is not a valid Socket");

const uint8_t sec = tls != R_NilValue;
const int sec = tls != R_NilValue;

if (sec && NANO_TAG(tls) != nano_TlsSymbol)
Rf_error("'tls' is not a valid TLS Configuration");
Expand All @@ -189,18 +189,13 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
nng_listener *lp = R_Calloc(1, nng_listener);
SEXP listener, attr, newattr, xp;
nng_tls_config *cfg;
nng_url *up;
int xc;

if (sec) {
if ((xc = nng_listener_create(lp, *sock, ur)) ||
(xc = nng_url_parse(&up, ur)))
goto exitlevel1;
cfg = (nng_tls_config *) NANO_PTR(tls);
if ((xc = nng_listener_set_ptr(*lp, NNG_OPT_TLS_CONFIG, cfg)))
goto exitlevel2;
nng_url_free(up);
if (start && (xc = nng_listener_start(*lp, 0)))
if ((xc = nng_listener_create(lp, *sock, ur)) ||
(xc = nng_listener_set_ptr(*lp, NNG_OPT_TLS_CONFIG, cfg)) ||
(start && (xc = nng_listener_start(*lp, 0))))
goto exitlevel1;
nng_tls_config_hold(cfg);

Expand Down Expand Up @@ -238,8 +233,6 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
UNPROTECT(2);
return nano_success;

exitlevel2:
nng_url_free(up);
exitlevel1:
R_Free(lp);
if (NANO_INTEGER(error)) ERROR_OUT(xc);
Expand Down

0 comments on commit 63792bd

Please sign in to comment.