Skip to content

Commit f5fa440

Browse files
committed
lws_ss_validity_confirmed
1 parent 2d2abeb commit f5fa440

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

include/libwebsockets/lws-secure-streams.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,30 @@ LWS_VISIBLE LWS_EXTERN int
670670
lws_ss_adopt_raw(struct lws_ss_handle *ss, lws_sock_file_fd_type fd);
671671
#endif
672672

673+
/*
674+
* lws_ss_validity_confirmed() - reset the validity timer for a network connection
675+
*
676+
* \param h: the SS handle
677+
*
678+
* Network connections are subject to intervals defined by the context, the
679+
* vhost if server connections, or the client connect info if a client
680+
* connection. If the connection goes longer than the specified time since
681+
* last observing traffic that can only happen if traffic is passing in both
682+
* directions, then lws will try to create a PING transaction on the network
683+
* connection.
684+
*
685+
* If the connection reaches the specified `.secs_since_valid_hangup` time
686+
* still without any proof of validity, the connection will be closed.
687+
*
688+
* If the PONG comes, or user code observes traffic that satisfies the proof
689+
* that both directions are passing traffic to the peer and calls this api,
690+
* the connection validity timer is reset and the scheme repeats.
691+
*/
692+
LWS_VISIBLE LWS_EXTERN void
693+
lws_ss_validity_confirmed(struct lws_ss_handle *h);
694+
695+
696+
673697
#if defined(LWS_WITH_SECURE_STREAMS_AUTH_SIGV4)
674698
/**
675699
* lws_ss_sigv4_set_aws_key() - set aws credential into system blob

lib/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,9 @@ if (LWS_WITH_SHARED)
300300
(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") OR
301301
(${CMAKE_SYSTEM_NAME} MATCHES "QNX")))
302302
if (LWS_WITH_SHARED)
303-
target_link_libraries(websockets_shared dl)
304-
endif()
303+
# target_link_libraries(websockets_shared)
304+
list(APPEND LIB_LIST dl)
305+
endif()
305306
endif()
306307
endif()
307308

@@ -333,7 +334,9 @@ endif()
333334

334335
# Setup the linking for all libs.
335336
foreach (lib ${LWS_LIBRARIES})
336-
target_link_libraries(${lib} PRIVATE ${LIB_LIST})
337+
# target_link_libraries(${lib} PRIVATE ${LIB_LIST})
338+
target_link_libraries(${lib} ${LIB_LIST})
339+
337340
endforeach()
338341

339342
#

lib/secure-streams/secure-streams.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,14 @@ lws_log_prepend_ss(struct lws_log_cx *cx, void *obj, char **p, char *e)
21442144
lws_ss_tag(h));
21452145
}
21462146

2147+
void
2148+
lws_ss_validity_confirmed(struct lws_ss_handle *h)
2149+
{
2150+
if (h->wsi)
2151+
lws_validity_confirmed(h->wsi);
2152+
}
2153+
2154+
21472155
#if defined(_DEBUG)
21482156
void
21492157
lws_ss_assert_extant(struct lws_context *cx, int tsi, struct lws_ss_handle *h)

0 commit comments

Comments
 (0)