mirror of
https://github.com/godotengine/godot
synced 2024-09-05 13:28:28 +00:00
Display set_nodelay to GDScript
Pass enabled arg Rename set_nodelay to set_no_delay Add description to the method Change description
This commit is contained in:
parent
f12e8568d4
commit
87adf9cfba
|
@ -83,7 +83,7 @@ int64_t FileAccessNetworkClient::get_64() {
|
|||
|
||||
void FileAccessNetworkClient::_thread_func() {
|
||||
|
||||
client->set_nodelay(true);
|
||||
client->set_no_delay(true);
|
||||
while (!quit) {
|
||||
|
||||
DEBUG_PRINT("SEM WAIT - " + itos(sem->get()));
|
||||
|
|
|
@ -55,6 +55,7 @@ void StreamPeerTCP::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_connected_host"), &StreamPeerTCP::get_connected_host);
|
||||
ClassDB::bind_method(D_METHOD("get_connected_port"), &StreamPeerTCP::get_connected_port);
|
||||
ClassDB::bind_method(D_METHOD("disconnect_from_host"), &StreamPeerTCP::disconnect_from_host);
|
||||
ClassDB::bind_method(D_METHOD("set_no_delay", "enabled"), &StreamPeerTCP::set_no_delay);
|
||||
|
||||
BIND_ENUM_CONSTANT(STATUS_NONE);
|
||||
BIND_ENUM_CONSTANT(STATUS_CONNECTING);
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
virtual void disconnect_from_host() = 0;
|
||||
virtual IP_Address get_connected_host() const = 0;
|
||||
virtual uint16_t get_connected_port() const = 0;
|
||||
virtual void set_nodelay(bool p_enabled) = 0;
|
||||
virtual void set_no_delay(bool p_enabled) = 0;
|
||||
|
||||
static Ref<StreamPeerTCP> create_ref();
|
||||
static StreamPeerTCP *create();
|
||||
|
|
|
@ -29,6 +29,16 @@
|
|||
Disconnect from host.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_no_delay">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="enabled" type="bool">
|
||||
</argument>
|
||||
<description>
|
||||
Disable Nagle algorithm to improve latency for small packets.
|
||||
Note that for applications that send large packets, or need to transfer a lot of data, this can reduce total bandwidth.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connected_host" qualifiers="const">
|
||||
<return type="String">
|
||||
</return>
|
||||
|
|
|
@ -304,7 +304,7 @@ Error StreamPeerTCPPosix::read(uint8_t *p_buffer, int p_bytes, int &r_received,
|
|||
return OK;
|
||||
};
|
||||
|
||||
void StreamPeerTCPPosix::set_nodelay(bool p_enabled) {
|
||||
void StreamPeerTCPPosix::set_no_delay(bool p_enabled) {
|
||||
|
||||
ERR_FAIL_COND(!is_connected_to_host());
|
||||
int flag = p_enabled ? 1 : 0;
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
virtual Status get_status() const;
|
||||
virtual void disconnect_from_host();
|
||||
|
||||
virtual void set_nodelay(bool p_enabled);
|
||||
virtual void set_no_delay(bool p_enabled);
|
||||
|
||||
static void make_default();
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ Error StreamPeerTCPWinsock::connect_to_host(const IP_Address &p_host, uint16_t p
|
|||
return OK;
|
||||
};
|
||||
|
||||
void StreamPeerTCPWinsock::set_nodelay(bool p_enabled) {
|
||||
void StreamPeerTCPWinsock::set_no_delay(bool p_enabled) {
|
||||
ERR_FAIL_COND(!is_connected_to_host());
|
||||
int flag = p_enabled ? 1 : 0;
|
||||
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
static void make_default();
|
||||
static void cleanup();
|
||||
|
||||
virtual void set_nodelay(bool p_enabled);
|
||||
virtual void set_no_delay(bool p_enabled);
|
||||
|
||||
StreamPeerTCPWinsock();
|
||||
~StreamPeerTCPWinsock();
|
||||
|
|
|
@ -55,7 +55,7 @@ void EditorFileServer::_subthread_start(void *s) {
|
|||
|
||||
ClientData *cd = (ClientData *)s;
|
||||
|
||||
cd->connection->set_nodelay(true);
|
||||
cd->connection->set_no_delay(true);
|
||||
uint8_t buf4[8];
|
||||
Error err = cd->connection->get_data(buf4, 4);
|
||||
if (err != OK) {
|
||||
|
|
Loading…
Reference in a new issue