api make close api private only
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/changelog b/changelog
index 19db24a..f69fc12 100644
--- a/changelog
+++ b/changelog
@@ -82,6 +82,11 @@
connection you must do so from the user callback and by returning
-1 from there.
+ - libwebsocket_close_and_free_session() is now private to the library code
+ only and not exposed for user code. If you want to close the
+ connection, you must do so from the user callback by returning -1
+ from there.
+
New features
------------
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index db95fe8..9a59032 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -917,10 +917,6 @@
struct libwebsocket *wsi, int fd, char *name, int name_len,
char *rip, int rip_len);
-LWS_EXTERN void
-libwebsocket_close_and_free_session(struct libwebsocket_context *context,
- struct libwebsocket *wsi, enum lws_close_status);
-
LWS_EXTERN int
libwebsockets_get_random(struct libwebsocket_context *context,
void *buf, int len);
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index d93621d..f98d3fd 100644
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -401,6 +401,10 @@
#endif
};
+extern void
+libwebsocket_close_and_free_session(struct libwebsocket_context *context,
+ struct libwebsocket *wsi, enum lws_close_status);
+
#ifndef LWS_LATENCY
static inline void lws_latency(struct libwebsocket_context *context,
struct libwebsocket *wsi, const char *action,
diff --git a/test-server/test-server.c b/test-server/test-server.c
index 862124d..1ccffc4 100644
--- a/test-server/test-server.c
+++ b/test-server/test-server.c
@@ -287,8 +287,7 @@
}
if (close_testing && pss->number == 50) {
lwsl_info("close tesing limit, closing\n");
- libwebsocket_close_and_free_session(context, wsi,
- LWS_CLOSE_STATUS_NORMAL);
+ return -1;
}
break;