Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
ee90da4a
Commit
ee90da4a
authored
Jun 14, 2019
by
Fabio Alessandrelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow setting websocket buffers sizes internally.
Needed by LSP.
parent
0a3c21d9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
40 additions
and
0 deletions
+40
-0
emws_client.cpp
modules/websocket/emws_client.cpp
+6
-0
emws_client.h
modules/websocket/emws_client.h
+1
-0
emws_server.cpp
modules/websocket/emws_server.cpp
+4
-0
emws_server.h
modules/websocket/emws_server.h
+1
-0
lws_client.cpp
modules/websocket/lws_client.cpp
+11
-0
lws_client.h
modules/websocket/lws_client.h
+1
-0
lws_server.cpp
modules/websocket/lws_server.cpp
+11
-0
lws_server.h
modules/websocket/lws_server.h
+1
-0
websocket_client.h
modules/websocket/websocket_client.h
+2
-0
websocket_server.h
modules/websocket/websocket_server.h
+2
-0
No files found.
modules/websocket/emws_client.cpp
View file @
ee90da4a
...
...
@@ -205,6 +205,12 @@ int EMWSClient::get_max_packet_size() const {
return
(
1
<<
_in_buf_size
)
-
PROTO_SIZE
;
}
Error
EMWSClient
::
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
)
{
_in_buf_size
=
nearest_shift
(
p_in_buffer
-
1
)
+
10
;
_in_pkt_size
=
nearest_shift
(
p_in_packets
-
1
);
return
OK
;
}
EMWSClient
::
EMWSClient
()
{
_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
);
...
...
modules/websocket/emws_client.h
View file @
ee90da4a
...
...
@@ -49,6 +49,7 @@ private:
public
:
bool
_is_connecting
;
Error
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
);
Error
connect_to_host
(
String
p_host
,
String
p_path
,
uint16_t
p_port
,
bool
p_ssl
,
PoolVector
<
String
>
p_protocol
=
PoolVector
<
String
>
());
Ref
<
WebSocketPeer
>
get_peer
(
int
p_peer_id
)
const
;
void
disconnect_from_host
(
int
p_code
=
1000
,
String
p_reason
=
""
);
...
...
modules/websocket/emws_server.cpp
View file @
ee90da4a
...
...
@@ -79,6 +79,10 @@ int EMWSServer::get_max_packet_size() const {
return
0
;
}
Error
EMWSServer
::
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
)
{
return
OK
;
}
EMWSServer
::
EMWSServer
()
{
}
...
...
modules/websocket/emws_server.h
View file @
ee90da4a
...
...
@@ -42,6 +42,7 @@ class EMWSServer : public WebSocketServer {
GDCIIMPL
(
EMWSServer
,
WebSocketServer
);
public
:
Error
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
);
Error
listen
(
int
p_port
,
PoolVector
<
String
>
p_protocols
=
PoolVector
<
String
>
(),
bool
gd_mp_api
=
false
);
void
stop
();
bool
is_listening
()
const
;
...
...
modules/websocket/lws_client.cpp
View file @
ee90da4a
...
...
@@ -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
);
...
...
modules/websocket/lws_client.h
View file @
ee90da4a
...
...
@@ -51,6 +51,7 @@ private:
int
_out_pkt_size
;
public
:
Error
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
);
Error
connect_to_host
(
String
p_host
,
String
p_path
,
uint16_t
p_port
,
bool
p_ssl
,
PoolVector
<
String
>
p_protocol
=
PoolVector
<
String
>
());
int
get_max_packet_size
()
const
;
Ref
<
WebSocketPeer
>
get_peer
(
int
p_peer_id
)
const
;
...
...
modules/websocket/lws_server.cpp
View file @
ee90da4a
...
...
@@ -197,6 +197,17 @@ void LWSServer::disconnect_peer(int p_peer_id, int p_code, String p_reason) {
get_peer
(
p_peer_id
)
->
close
(
p_code
,
p_reason
);
}
Error
LWSServer
::
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
;
}
LWSServer
::
LWSServer
()
{
_in_buf_size
=
nearest_shift
((
int
)
GLOBAL_GET
(
WSS_IN_BUF
)
-
1
)
+
10
;
_in_pkt_size
=
nearest_shift
((
int
)
GLOBAL_GET
(
WSS_IN_PKT
)
-
1
);
...
...
modules/websocket/lws_server.h
View file @
ee90da4a
...
...
@@ -52,6 +52,7 @@ private:
int
_out_pkt_size
;
public
:
Error
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
);
Error
listen
(
int
p_port
,
PoolVector
<
String
>
p_protocols
=
PoolVector
<
String
>
(),
bool
gd_mp_api
=
false
);
void
stop
();
bool
is_listening
()
const
;
...
...
modules/websocket/websocket_client.h
View file @
ee90da4a
...
...
@@ -67,6 +67,8 @@ public:
void
_on_disconnect
(
bool
p_was_clean
);
void
_on_error
();
virtual
Error
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
)
=
0
;
WebSocketClient
();
~
WebSocketClient
();
};
...
...
modules/websocket/websocket_server.h
View file @
ee90da4a
...
...
@@ -62,6 +62,8 @@ public:
void
_on_disconnect
(
int32_t
p_peer_id
,
bool
p_was_clean
);
void
_on_close_request
(
int32_t
p_peer_id
,
int
p_code
,
String
p_reason
);
virtual
Error
set_buffers
(
int
p_in_buffer
,
int
p_in_packets
,
int
p_out_buffer
,
int
p_out_packets
)
=
0
;
WebSocketServer
();
~
WebSocketServer
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment