From eb1f8db4ed87867f0f08afba79253e3981db9c88 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 26 Dec 2017 16:18:38 -0800 Subject: fixes #165 Add address properties for websocket pipes --- src/supplemental/websocket/websocket.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/supplemental/websocket/websocket.c') diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index fe0a9bd9..dfcac3e7 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -646,6 +646,26 @@ ws_send_control(nni_ws *ws, uint8_t op, uint8_t *buf, size_t len) nni_mtx_unlock(&ws->mtx); } +int +nni_ws_sock_addr(nni_ws *ws, nni_sockaddr *sa) +{ + int rv; + nni_mtx_lock(&ws->mtx); + rv = ws->closed ? NNG_ECLOSED : nni_http_sock_addr(ws->http, sa); + nni_mtx_unlock(&ws->mtx); + return (rv); +} + +int +nni_ws_peer_addr(nni_ws *ws, nni_sockaddr *sa) +{ + int rv; + nni_mtx_lock(&ws->mtx); + rv = ws->closed ? NNG_ECLOSED : nni_http_peer_addr(ws->http, sa); + nni_mtx_unlock(&ws->mtx); + return (rv); +} + void nni_ws_send_msg(nni_ws *ws, nni_aio *aio) { -- cgit v1.2.3-70-g09d2