summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/http_client.cpp3
-rw-r--r--core/io/marshalls.cpp2
-rw-r--r--core/io/networked_multiplayer_peer.cpp4
-rw-r--r--core/io/networked_multiplayer_peer.h1
-rw-r--r--core/io/packet_peer.cpp14
-rw-r--r--core/io/packet_peer.h1
-rw-r--r--core/io/stream_peer.cpp30
-rw-r--r--core/io/stream_peer.h2
-rw-r--r--core/io/stream_peer_ssl.cpp1
-rw-r--r--core/io/stream_peer_ssl.h1
-rw-r--r--core/io/stream_peer_tcp.cpp1
-rw-r--r--core/io/stream_peer_tcp.h2
13 files changed, 46 insertions, 18 deletions
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 7b2bccdfec..ef886cdb3c 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -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()));
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 54743d37af..a9eb9466b7 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -682,6 +682,9 @@ void HTTPClient::_bind_methods() {
ClassDB::bind_method(D_METHOD("query_string_from_dict", "fields"), &HTTPClient::query_string_from_dict);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_mode_enabled"), "set_blocking_mode", "is_blocking_mode_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "connection", PROPERTY_HINT_RESOURCE_TYPE, "StreamPeer", 0), "set_connection", "get_connection");
+
BIND_ENUM_CONSTANT(METHOD_GET);
BIND_ENUM_CONSTANT(METHOD_HEAD);
BIND_ENUM_CONSTANT(METHOD_POST);
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 35b9a8610c..9e21287780 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -333,7 +333,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
len -= 12;
buf += 12;
- if (flags & 2) // Obsolete format with property seperate from subpath
+ if (flags & 2) // Obsolete format with property separate from subpath
subnamecount++;
uint32_t total = namecount + subnamecount;
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index dbfb6d9a81..6354eef8b5 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -33,6 +33,7 @@
void NetworkedMultiplayerPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_transfer_mode", "mode"), &NetworkedMultiplayerPeer::set_transfer_mode);
+ ClassDB::bind_method(D_METHOD("get_transfer_mode"), &NetworkedMultiplayerPeer::get_transfer_mode);
ClassDB::bind_method(D_METHOD("set_target_peer", "id"), &NetworkedMultiplayerPeer::set_target_peer);
ClassDB::bind_method(D_METHOD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer);
@@ -45,6 +46,9 @@ void NetworkedMultiplayerPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_refuse_new_connections", "enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections);
ClassDB::bind_method(D_METHOD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_connections"), "set_refuse_new_connections", "is_refusing_new_connections");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_mode", PROPERTY_HINT_ENUM, "Unreliable,Unreliable Ordered,Reliable"), "set_transfer_mode", "get_transfer_mode");
+
BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE);
BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE_ORDERED);
BIND_ENUM_CONSTANT(TRANSFER_MODE_RELIABLE);
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index 057b933dc9..66089c27b9 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -58,6 +58,7 @@ public:
};
virtual void set_transfer_mode(TransferMode p_mode) = 0;
+ virtual TransferMode get_transfer_mode() const = 0;
virtual void set_target_peer(int p_peer_id) = 0;
virtual int get_packet_peer() const = 0;
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 9cfa04346c..bd851ebb6d 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -141,6 +141,8 @@ void PacketPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_object_decoding", "enable"), &PacketPeer::set_allow_object_decoding);
ClassDB::bind_method(D_METHOD("is_object_decoding_allowed"), &PacketPeer::is_object_decoding_allowed);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_object_decoding"), "set_allow_object_decoding", "is_object_decoding_allowed");
};
/***************/
@@ -153,11 +155,16 @@ void PacketPeerStream::_set_stream_peer(REF p_peer) {
void PacketPeerStream::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer);
+ ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::set_stream_peer);
+ ClassDB::bind_method(D_METHOD("get_stream_peer"), &PacketPeerStream::get_stream_peer);
ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size);
ClassDB::bind_method(D_METHOD("get_input_buffer_max_size"), &PacketPeerStream::get_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("get_output_buffer_max_size"), &PacketPeerStream::get_output_buffer_max_size);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "input_buffer_max_size"), "set_input_buffer_max_size", "get_input_buffer_max_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "output_buffer_max_size"), "set_output_buffer_max_size", "get_output_buffer_max_size");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream_peer", PROPERTY_HINT_RESOURCE_TYPE, "StreamPeer", 0), "set_stream_peer", "get_stream_peer");
}
Error PacketPeerStream::_poll_buffer() const {
@@ -262,6 +269,11 @@ void PacketPeerStream::set_stream_peer(const Ref<StreamPeer> &p_peer) {
peer = p_peer;
}
+Ref<StreamPeer> PacketPeerStream::get_stream_peer() const {
+
+ return peer;
+}
+
void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
//warning may lose packets
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index 6636d56959..b10152e96b 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -98,6 +98,7 @@ public:
virtual int get_max_packet_size() const;
void set_stream_peer(const Ref<StreamPeer> &p_peer);
+ Ref<StreamPeer> get_stream_peer() const;
void set_input_buffer_max_size(int p_max_size);
int get_input_buffer_max_size() const;
void set_output_buffer_max_size(int p_max_size);
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index f142abd3a4..927b9f6366 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -310,7 +310,7 @@ float StreamPeer::get_float() {
return decode_float(buf);
}
-float StreamPeer::get_double() {
+double StreamPeer::get_double() {
uint8_t buf[8];
get_data(buf, 8);
@@ -375,18 +375,18 @@ void StreamPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_big_endian", "enable"), &StreamPeer::set_big_endian);
ClassDB::bind_method(D_METHOD("is_big_endian_enabled"), &StreamPeer::is_big_endian_enabled);
- ClassDB::bind_method(D_METHOD("put_8", "val"), &StreamPeer::put_8);
- ClassDB::bind_method(D_METHOD("put_u8", "val"), &StreamPeer::put_u8);
- ClassDB::bind_method(D_METHOD("put_16", "val"), &StreamPeer::put_16);
- ClassDB::bind_method(D_METHOD("put_u16", "val"), &StreamPeer::put_u16);
- ClassDB::bind_method(D_METHOD("put_32", "val"), &StreamPeer::put_32);
- ClassDB::bind_method(D_METHOD("put_u32", "val"), &StreamPeer::put_u32);
- ClassDB::bind_method(D_METHOD("put_64", "val"), &StreamPeer::put_64);
- ClassDB::bind_method(D_METHOD("put_u64", "val"), &StreamPeer::put_u64);
- ClassDB::bind_method(D_METHOD("put_float", "val"), &StreamPeer::put_float);
- ClassDB::bind_method(D_METHOD("put_double", "val"), &StreamPeer::put_double);
- ClassDB::bind_method(D_METHOD("put_utf8_string", "val"), &StreamPeer::put_utf8_string);
- ClassDB::bind_method(D_METHOD("put_var", "val"), &StreamPeer::put_var);
+ ClassDB::bind_method(D_METHOD("put_8", "value"), &StreamPeer::put_8);
+ ClassDB::bind_method(D_METHOD("put_u8", "value"), &StreamPeer::put_u8);
+ ClassDB::bind_method(D_METHOD("put_16", "value"), &StreamPeer::put_16);
+ ClassDB::bind_method(D_METHOD("put_u16", "value"), &StreamPeer::put_u16);
+ ClassDB::bind_method(D_METHOD("put_32", "value"), &StreamPeer::put_32);
+ ClassDB::bind_method(D_METHOD("put_u32", "value"), &StreamPeer::put_u32);
+ ClassDB::bind_method(D_METHOD("put_64", "value"), &StreamPeer::put_64);
+ ClassDB::bind_method(D_METHOD("put_u64", "value"), &StreamPeer::put_u64);
+ ClassDB::bind_method(D_METHOD("put_float", "value"), &StreamPeer::put_float);
+ ClassDB::bind_method(D_METHOD("put_double", "value"), &StreamPeer::put_double);
+ ClassDB::bind_method(D_METHOD("put_utf8_string", "value"), &StreamPeer::put_utf8_string);
+ ClassDB::bind_method(D_METHOD("put_var", "value"), &StreamPeer::put_var);
ClassDB::bind_method(D_METHOD("get_8"), &StreamPeer::get_8);
ClassDB::bind_method(D_METHOD("get_u8"), &StreamPeer::get_u8);
@@ -401,6 +401,8 @@ void StreamPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_string", "bytes"), &StreamPeer::get_string);
ClassDB::bind_method(D_METHOD("get_utf8_string", "bytes"), &StreamPeer::get_utf8_string);
ClassDB::bind_method(D_METHOD("get_var"), &StreamPeer::get_var);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "big_endian"), "set_big_endian", "is_big_endian_enabled");
}
////////////////////////////////
@@ -414,6 +416,8 @@ void StreamPeerBuffer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_data_array"), &StreamPeerBuffer::get_data_array);
ClassDB::bind_method(D_METHOD("clear"), &StreamPeerBuffer::clear);
ClassDB::bind_method(D_METHOD("duplicate"), &StreamPeerBuffer::duplicate);
+
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data_array"), "set_data_array", "get_data_array");
}
Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) {
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index ff9ae788ec..605b0a7980 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -83,7 +83,7 @@ public:
uint64_t get_u64();
int64_t get_64();
float get_float();
- float get_double();
+ double get_double();
String get_string(int p_bytes);
String get_utf8_string(int p_bytes);
Variant get_var();
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index 633b353102..07a01ff99f 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -52,6 +52,7 @@ bool StreamPeerSSL::is_available() {
void StreamPeerSSL::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll);
ClassDB::bind_method(D_METHOD("accept_stream", "stream"), &StreamPeerSSL::accept_stream);
ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()));
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status);
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index e4d14ebdfd..f903438c28 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -57,6 +57,7 @@ public:
STATUS_ERROR_HOSTNAME_MISMATCH
};
+ virtual void poll() = 0;
virtual Error accept_stream(Ref<StreamPeer> p_base) = 0;
virtual Error connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs = false, const String &p_for_hostname = String()) = 0;
virtual Status get_status() const = 0;
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 9cfa810034..5d008904ff 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -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);
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index fc84525c5f..8a16d820f2 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -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();