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)

(cherry picked from commit 88a56ba783)
This commit is contained in:
Fabio Alessandrelli 2017-01-18 12:47:12 +01:00
parent 0b9684a085
commit d9525082fe
18 changed files with 13 additions and 65 deletions

View file

@ -42,7 +42,7 @@ Error PacketPeerUDP::_set_send_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_send_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() {
ObjectTypeDB::bind_method(_MD("set_ip_type", "ip_type"), &PacketPeerUDP::set_ip_type);
ObjectTypeDB::bind_method(_MD("listen:Error", "port", "bind_address", "recv_buf_size"), &PacketPeerUDP::listen, DEFVAL("*"), DEFVAL(65536));
ObjectTypeDB::bind_method(_MD("close"), &PacketPeerUDP::close);
ObjectTypeDB::bind_method(_MD("wait:Error"), &PacketPeerUDP::wait);
@ -84,5 +78,4 @@ PacketPeerUDP *PacketPeerUDP::create() {
}
PacketPeerUDP::PacketPeerUDP() {
ip_type = IP::TYPE_ANY;
}