summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-14 11:07:57 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-14 11:10:42 -0300
commitdcb95ec1473eff3f455909cd81c3cd50b1e1159b (patch)
tree60343275911d48ebf993041dec92e1eac112b746 /core/io
parent93ab45b6b5c4f8e0619e963156c983009d399a9d (diff)
removed duplicated functions in class hierarchy that were bound more than once
added a check to detect this case in the future
Diffstat (limited to 'core/io')
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/http_client.cpp12
-rw-r--r--core/io/http_client.h2
-rw-r--r--core/io/stream_peer_ssl.cpp6
-rw-r--r--core/io/stream_peer_ssl.h6
-rw-r--r--core/io/stream_peer_tcp.cpp10
-rw-r--r--core/io/stream_peer_tcp.h6
7 files changed, 22 insertions, 22 deletions
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 662902281b..7bf750f6e1 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -206,7 +206,7 @@ Error FileAccessNetworkClient::connect(const String& p_host,int p_port,const Str
}
DEBUG_PRINT("IP: "+String(ip)+" port "+itos(p_port));
- Error err = client->connect(ip,p_port);
+ Error err = client->connect_to_host(ip,p_port);
ERR_FAIL_COND_V(err,err);
while(client->get_status()==StreamPeerTCP::STATUS_CONNECTING) {
//DEBUG_PRINT("trying to connect....");
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 5e57f55f87..63c8abbbad 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -33,7 +33,7 @@ void HTTPClient::set_ip_type(IP::Type p_type) {
ip_type = p_type;
}
-Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){
+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);
@@ -57,7 +57,7 @@ Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_ve
if (conn_host.is_valid_ip_address()) {
//is ip
- Error err = tcp_connection->connect(IP_Address(conn_host),p_port);
+ Error err = tcp_connection->connect_to_host(IP_Address(conn_host),p_port);
if (err) {
status=STATUS_CANT_CONNECT;
return err;
@@ -232,7 +232,7 @@ Error HTTPClient::get_response_headers(List<String> *r_response) {
void HTTPClient::close(){
if (tcp_connection->get_status()!=StreamPeerTCP::STATUS_NONE)
- tcp_connection->disconnect();
+ tcp_connection->disconnect_from_host();
connection.unref();
status=STATUS_DISCONNECTED;
@@ -267,7 +267,7 @@ Error HTTPClient::poll(){
case IP::RESOLVER_STATUS_DONE: {
IP_Address host = IP::get_singleton()->get_resolve_item_address(resolving);
- Error err = tcp_connection->connect(host,conn_port);
+ Error err = tcp_connection->connect_to_host(host,conn_port);
IP::get_singleton()->erase_resolve_item(resolving);
resolving=IP::RESOLVER_INVALID_ID;
if (err) {
@@ -300,7 +300,7 @@ Error HTTPClient::poll(){
case StreamPeerTCP::STATUS_CONNECTED: {
if (ssl) {
Ref<StreamPeerSSL> ssl = StreamPeerSSL::create();
- Error err = ssl->connect(tcp_connection,true,ssl_verify_host?conn_host:String());
+ Error err = ssl->connect_to_stream(tcp_connection,true,ssl_verify_host?conn_host:String());
if (err!=OK) {
close();
status=STATUS_SSL_HANDSHAKE_ERROR;
@@ -640,7 +640,7 @@ 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:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true));
+ 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);
ClassDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index c6f96db1d6..496d22530b 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -167,7 +167,7 @@ public:
void set_ip_type(IP::Type p_type);
//Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request
- Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true);
+ Error connect_to_host(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true);
void set_connection(const Ref<StreamPeer>& p_connection);
Ref<StreamPeer> get_connection() const;
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index aab42a2989..fc535e94b0 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -57,10 +57,10 @@ bool StreamPeerSSL::is_available() {
void StreamPeerSSL::_bind_methods() {
- ClassDB::bind_method(_MD("accept:Error","stream:StreamPeer"),&StreamPeerSSL::accept);
- ClassDB::bind_method(_MD("connect:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect,DEFVAL(false),DEFVAL(String()));
+ ClassDB::bind_method(_MD("accept_stream:Error","stream:StreamPeer"),&StreamPeerSSL::accept_stream);
+ ClassDB::bind_method(_MD("connect_to_stream:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect_to_stream,DEFVAL(false),DEFVAL(String()));
ClassDB::bind_method(_MD("get_status"),&StreamPeerSSL::get_status);
- ClassDB::bind_method(_MD("disconnect"),&StreamPeerSSL::disconnect);
+ ClassDB::bind_method(_MD("disconnect_from_stream"),&StreamPeerSSL::disconnect_from_stream);
BIND_CONSTANT( STATUS_DISCONNECTED );
BIND_CONSTANT( STATUS_CONNECTED );
BIND_CONSTANT( STATUS_ERROR_NO_CERTIFICATE );
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index 8675433a30..9aafac874d 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -57,11 +57,11 @@ public:
STATUS_ERROR_HOSTNAME_MISMATCH
};
- virtual Error accept(Ref<StreamPeer> p_base)=0;
- virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=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;
- virtual void disconnect()=0;
+ virtual void disconnect_from_stream()=0;
static StreamPeerSSL* create();
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 2218057cf7..0a59c32995 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -41,24 +41,24 @@ Error StreamPeerTCP::_connect(const String& p_address,int p_port) {
return ERR_CANT_RESOLVE;
}
- connect(ip,p_port);
+ connect_to_host(ip,p_port);
return OK;
}
void StreamPeerTCP::set_ip_type(IP::Type p_type) {
- disconnect();
+ disconnect_from_host();
ip_type = p_type;
}
void StreamPeerTCP::_bind_methods() {
ClassDB::bind_method(_MD("set_ip_type","ip_type"),&StreamPeerTCP::set_ip_type);
- ClassDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::_connect);
- ClassDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected);
+ ClassDB::bind_method(_MD("connect_to_host","host","port"),&StreamPeerTCP::_connect);
+ ClassDB::bind_method(_MD("is_connected_to_host"),&StreamPeerTCP::is_connected_to_host);
ClassDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status);
ClassDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host);
ClassDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port);
- ClassDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect);
+ ClassDB::bind_method(_MD("disconnect_from_host"),&StreamPeerTCP::disconnect_from_host);
BIND_CONSTANT( STATUS_NONE );
BIND_CONSTANT( STATUS_CONNECTING );
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index 8f6dfaf3f8..2b25f31739 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -60,13 +60,13 @@ protected:
public:
virtual void set_ip_type(IP::Type p_type);
- virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0;
+ virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port)=0;
//read/write from streampeer
- virtual bool is_connected() const=0;
+ virtual bool is_connected_to_host() const=0;
virtual Status get_status() const=0;
- virtual void disconnect()=0;
+ 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;