diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-10-28 15:53:23 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-10-28 16:13:11 -0700 |
| commit | 801ace5e9adca4e53497d6c7133cc32cf94b23b7 (patch) | |
| tree | 8bbfb96e513fedce9b2cb29672f99fce0c5d54bd /src/supplemental | |
| parent | caa0c875339badd5a0da38aee9605a40cb7e9d83 (diff) | |
| download | nng-801ace5e9adca4e53497d6c7133cc32cf94b23b7.tar.gz nng-801ace5e9adca4e53497d6c7133cc32cf94b23b7.tar.bz2 nng-801ace5e9adca4e53497d6c7133cc32cf94b23b7.zip | |
Remove nng_stream_set function family.
This was not really used or useful.
Diffstat (limited to 'src/supplemental')
| -rw-r--r-- | src/supplemental/http/http_api.h | 4 | ||||
| -rw-r--r-- | src/supplemental/http/http_conn.c | 15 | ||||
| -rw-r--r-- | src/supplemental/tls/tls_common.c | 16 | ||||
| -rw-r--r-- | src/supplemental/websocket/websocket.c | 29 | ||||
| -rw-r--r-- | src/supplemental/websocket/websocket_test.c | 11 |
5 files changed, 1 insertions, 74 deletions
diff --git a/src/supplemental/http/http_api.h b/src/supplemental/http/http_api.h index 70a43432..813f9fe6 100644 --- a/src/supplemental/http/http_api.h +++ b/src/supplemental/http/http_api.h @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // Copyright 2019 Devolutions <info@devolutions.net> // @@ -102,8 +102,6 @@ extern void nni_http_conn_close(nni_http_conn *); extern void nni_http_conn_fini(nni_http_conn *); extern int nni_http_conn_getopt( nni_http_conn *, const char *, void *, size_t *, nni_type); -extern int nni_http_conn_setopt( - nni_http_conn *, const char *, const void *, size_t, nni_type); // Reading messages -- the caller must supply a preinitialized (but otherwise // idle) message. We recommend the caller store this in the aio's user data. diff --git a/src/supplemental/http/http_conn.c b/src/supplemental/http/http_conn.c index 03d1a1f5..33ed70bb 100644 --- a/src/supplemental/http/http_conn.c +++ b/src/supplemental/http/http_conn.c @@ -647,21 +647,6 @@ nni_http_conn_getopt( return (rv); } -int -nni_http_conn_setopt(nni_http_conn *conn, const char *name, const void *buf, - size_t sz, nni_type t) -{ - int rv; - nni_mtx_lock(&conn->mtx); - if (conn->closed) { - rv = NNG_ECLOSED; - } else { - rv = nni_stream_set(conn->sock, name, buf, sz, t); - } - nni_mtx_unlock(&conn->mtx); - return (rv); -} - void nni_http_conn_fini(nni_http_conn *conn) { diff --git a/src/supplemental/tls/tls_common.c b/src/supplemental/tls/tls_common.c index 02ca1442..139460f5 100644 --- a/src/supplemental/tls/tls_common.c +++ b/src/supplemental/tls/tls_common.c @@ -640,21 +640,6 @@ static const nni_option tls_options[] = { }; static int -tls_set(void *arg, const char *name, const void *buf, size_t sz, nni_type t) -{ - tls_conn *conn = arg; - int rv; - nng_stream *tcp; - - tcp = (conn != NULL) ? conn->tcp : NULL; - - if ((rv = nni_stream_set(tcp, name, buf, sz, t)) != NNG_ENOTSUP) { - return (rv); - } - return (nni_setopt(tls_options, name, conn, buf, sz, t)); -} - -static int tls_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t) { tls_conn *conn = arg; @@ -713,7 +698,6 @@ tls_alloc(tls_conn **conn_p, nng_tls_config *cfg, nng_aio *user_aio) conn->stream.s_send = tls_send; conn->stream.s_recv = tls_recv; conn->stream.s_get = tls_get; - conn->stream.s_set = tls_set; nng_tls_config_hold(cfg); *conn_p = conn; diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index daecbb31..ce733c84 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -179,7 +179,6 @@ static void ws_str_close(void *); static void ws_str_send(void *, nng_aio *); static void ws_str_recv(void *, nng_aio *); static int ws_str_get(void *, const char *, void *, size_t *, nni_type); -static int ws_str_set(void *, const char *, const void *, size_t, nni_type); static void ws_listener_close(void *); static void ws_listener_free(void *); @@ -1461,7 +1460,6 @@ ws_init(nni_ws **wsp) ws->ops.s_send = ws_str_send; ws->ops.s_recv = ws_str_recv; ws->ops.s_get = ws_str_get; - ws->ops.s_set = ws_str_set; ws->fragsize = 1 << 20; // we won't send a frame larger than this *wsp = ws; @@ -2869,33 +2867,6 @@ static const nni_option ws_options[] = { }; static int -ws_str_set(void *arg, const char *nm, const void *buf, size_t sz, nni_type t) -{ - nni_ws *ws = arg; - int rv; - - // Headers can only be set. - nni_mtx_lock(&ws->mtx); - if (ws->closed) { - nni_mtx_unlock(&ws->mtx); - return (NNG_ECLOSED); - } - nni_mtx_unlock(&ws->mtx); - rv = nni_http_conn_setopt(ws->http, nm, buf, sz, t); - if (rv == NNG_ENOTSUP) { - rv = nni_setopt(ws_options, nm, ws, buf, sz, t); - } - if (rv == NNG_ENOTSUP) { - if (startswith(nm, NNG_OPT_WS_REQUEST_HEADER) || - startswith(nm, NNG_OPT_WS_RESPONSE_HEADER)) { - return (NNG_EREADONLY); - } - } - - return (rv); -} - -static int ws_get_req_header( nni_ws *ws, const char *nm, void *buf, size_t *szp, nni_type t) { diff --git a/src/supplemental/websocket/websocket_test.c b/src/supplemental/websocket/websocket_test.c index edd3d609..1b48aff5 100644 --- a/src/supplemental/websocket/websocket_test.c +++ b/src/supplemental/websocket/websocket_test.c @@ -175,26 +175,15 @@ test_websocket_conn_props(void) NUTS_TRUE(sa1.s_in.sa_addr == sa2.s_in.sa_addr); NUTS_TRUE(sa1.s_in.sa_port == sa2.s_in.sa_port); - on = true; - NUTS_PASS(nng_stream_set_bool(c1, NNG_OPT_TCP_NODELAY, on)); - NUTS_PASS(nng_stream_set_bool(c2, NNG_OPT_TCP_NODELAY, on)); - - NUTS_PASS(nng_stream_set_bool(c1, NNG_OPT_TCP_KEEPALIVE, on)); - NUTS_PASS(nng_stream_set_bool(c2, NNG_OPT_TCP_KEEPALIVE, on)); - NUTS_FAIL(nng_stream_set_string(c1, NNG_OPT_TCP_KEEPALIVE, "nope"), - NNG_EBADTYPE); - on = false; sz = sizeof(on); NUTS_PASS(nng_stream_get(c1, NNG_OPT_TCP_NODELAY, &on, &sz)); NUTS_TRUE(sz == sizeof(on)); NUTS_TRUE(on == true); - on = false; sz = sizeof(on); NUTS_PASS(nng_stream_get(c2, NNG_OPT_TCP_KEEPALIVE, &on, &sz)); NUTS_TRUE(sz == sizeof(on)); - NUTS_TRUE(on == true); NUTS_FAIL( nng_stream_get_size(c1, NNG_OPT_TCP_NODELAY, &sz), NNG_EBADTYPE); |
