From 801ace5e9adca4e53497d6c7133cc32cf94b23b7 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 28 Oct 2024 15:53:23 -0700 Subject: Remove nng_stream_set function family. This was not really used or useful. --- src/supplemental/websocket/websocket.c | 29 ----------------------------- src/supplemental/websocket/websocket_test.c | 11 ----------- 2 files changed, 40 deletions(-) (limited to 'src/supplemental/websocket') 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; @@ -2868,33 +2866,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); -- cgit v1.2.3-70-g09d2