summaryrefslogtreecommitdiff
path: root/modules/websocket/lws_client.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-17 11:27:23 +0200
committerGitHub <noreply@github.com>2019-06-17 11:27:23 +0200
commit363705e6875a24cb569a522257b1c443f050ae40 (patch)
treee5883f6e2f4f9edf5149fbcfdf7efb2d577bed6e /modules/websocket/lws_client.cpp
parent2935caa13f3623b80a903f8c3349cea48a417c00 (diff)
parent5b2f098ed4444572432eb2e67c154f89852039ec (diff)
Merge pull request #29781 from Faless/ws/set_buffers_internal
Allow setting websocket buffers sizes internally.
Diffstat (limited to 'modules/websocket/lws_client.cpp')
-rw-r--r--modules/websocket/lws_client.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp
index 08df76293b..f139a4ef66 100644
--- a/modules/websocket/lws_client.cpp
+++ b/modules/websocket/lws_client.cpp
@@ -215,6 +215,17 @@ uint16_t LWSClient::get_connected_port() const {
return 1025;
};
+Error LWSClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) {
+ ERR_EXPLAIN("Buffers sizes can only be set before listening or connecting");
+ ERR_FAIL_COND_V(context != NULL, FAILED);
+
+ _in_buf_size = nearest_shift(p_in_buffer - 1) + 10;
+ _in_pkt_size = nearest_shift(p_in_packets - 1);
+ _out_buf_size = nearest_shift(p_out_buffer - 1) + 10;
+ _out_pkt_size = nearest_shift(p_out_packets - 1);
+ return OK;
+}
+
LWSClient::LWSClient() {
_in_buf_size = nearest_shift((int)GLOBAL_GET(WSC_IN_BUF) - 1) + 10;
_in_pkt_size = nearest_shift((int)GLOBAL_GET(WSC_IN_PKT) - 1);