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

@ -29,14 +29,9 @@
#include "http_client.h"
#include "io/stream_peer_ssl.h"
void HTTPClient::set_ip_type(IP::Type p_type) {
ip_type = p_type;
}
Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){
close();
tcp_connection->set_ip_type(ip_type);
conn_port=p_port;
conn_host=p_host;
@ -66,7 +61,7 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,b
status=STATUS_CONNECTING;
} else {
//is hostname
resolving=IP::get_singleton()->resolve_hostname_queue_item(conn_host, ip_type);
resolving=IP::get_singleton()->resolve_hostname_queue_item(conn_host);
status=STATUS_RESOLVING;
}
@ -639,7 +634,6 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received)
void HTTPClient::_bind_methods() {
ClassDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPClient::set_ip_type);
ClassDB::bind_method(_MD("connect_to_host:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect_to_host,DEFVAL(false),DEFVAL(true));
ClassDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection);
ClassDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection);
@ -766,7 +760,6 @@ String HTTPClient::query_string_from_dict(const Dictionary& p_dict) {
HTTPClient::HTTPClient(){
ip_type = IP::TYPE_ANY;
tcp_connection = StreamPeerTCP::create_ref();
resolving = IP::RESOLVER_INVALID_ID;
status=STATUS_DISCONNECTED;