|
23 | 23 |
|
24 | 24 | // internals ------------------------------------------------------------------- |
25 | 25 |
|
26 | | -typedef enum nano_stream_typ { |
27 | | - DIALER, |
28 | | - LISTENER |
29 | | -} nano_stream_typ; |
30 | | - |
31 | 26 | typedef struct nano_stream_s { |
32 | 27 | nng_stream *stream; |
33 | | - nano_stream_typ type; |
| 28 | + enum { |
| 29 | + STREAM_DIALER, |
| 30 | + STREAM_LISTENER |
| 31 | + } type; |
34 | 32 | union { |
35 | 33 | nng_stream_dialer *dial; |
36 | 34 | nng_stream_listener *list; |
@@ -61,7 +59,7 @@ static void stream_finalizer(SEXP xptr) { |
61 | 59 | nano_stream *xp = (nano_stream *) R_ExternalPtrAddr(xptr); |
62 | 60 | nng_stream_close(xp->stream); |
63 | 61 | nng_stream_free(xp->stream); |
64 | | - if (xp->type == DIALER) { |
| 62 | + if (xp->type == STREAM_DIALER) { |
65 | 63 | nng_stream_dialer_close(xp->endpoint.dial); |
66 | 64 | nng_stream_dialer_free(xp->endpoint.dial); |
67 | 65 | } else { |
@@ -369,7 +367,7 @@ SEXP rnng_stream_dial(SEXP url, SEXP textframes, SEXP tls) { |
369 | 367 | if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) |
370 | 368 | Rf_error("'tls' is not a valid TLS Configuration"); |
371 | 369 | nano_stream *nst = R_Calloc(1, nano_stream); |
372 | | - nst->type = DIALER; |
| 370 | + nst->type = STREAM_DIALER; |
373 | 371 | nst->tls = NULL; |
374 | 372 | nng_url *up; |
375 | 373 | nng_aio *aiop; |
@@ -462,7 +460,7 @@ SEXP rnng_stream_listen(SEXP url, SEXP textframes, SEXP tls) { |
462 | 460 | if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) |
463 | 461 | Rf_error("'tls' is not a valid TLS Configuration"); |
464 | 462 | nano_stream *nst = R_Calloc(1, nano_stream); |
465 | | - nst->type = LISTENER; |
| 463 | + nst->type = STREAM_LISTENER; |
466 | 464 | nst->tls = NULL; |
467 | 465 | nng_url *up; |
468 | 466 | nng_aio *aiop; |
|
0 commit comments