1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Remove set_ip_type from network classes (no longer needed)

- TCP:
  - `listen` bind to wildcard "*" -> dual stack socket
  - `listen` bind to address -> socket from address type
  - `connect` -> resolve using best protocol (UNSPEC), socket from address type

- UDP:
  - `listen` bind to wildcard "*" -> dual stack socket
  - `listen` bind to address -> socket from address type
  - `put_packet`/`put_var` -> resolve using TYPE_ANY (UNSPEC), socket from address type
    (to change socket type you must first call `close` it)
This commit is contained in:
Fabio Alessandrelli
2017-01-18 12:47:12 +01:00
parent 2fe4ef6699
commit 88a56ba783
18 changed files with 15 additions and 66 deletions

View File

@@ -42,7 +42,7 @@ Error PacketPeerUDP::_set_dest_address(const String& p_address, int p_port) {
if (p_address.is_valid_ip_address()) {
ip=p_address;
} else {
ip=IP::get_singleton()->resolve_hostname(p_address, ip_type);
ip=IP::get_singleton()->resolve_hostname(p_address);
if (!ip.is_valid())
return ERR_CANT_RESOLVE;
}
@@ -51,14 +51,8 @@ Error PacketPeerUDP::_set_dest_address(const String& p_address, int p_port) {
return OK;
}
void PacketPeerUDP::set_ip_type(IP::Type p_type) {
close();
ip_type = p_type;
}
void PacketPeerUDP::_bind_methods() {
ClassDB::bind_method(_MD("set_ip_type","ip_type"),&PacketPeerUDP::set_ip_type);
ClassDB::bind_method(_MD("listen:Error","port", "bind_address", "recv_buf_size"),&PacketPeerUDP::listen,DEFVAL("*"),DEFVAL(65536));
ClassDB::bind_method(_MD("close"),&PacketPeerUDP::close);
ClassDB::bind_method(_MD("wait:Error"),&PacketPeerUDP::wait);
@@ -87,5 +81,5 @@ PacketPeerUDP* PacketPeerUDP::create() {
PacketPeerUDP::PacketPeerUDP()
{
ip_type = IP::TYPE_ANY;
}