summaryrefslogtreecommitdiffstats
path: root/core/io/tcp_server.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2016-11-30 20:45:19 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2016-12-09 18:24:59 +0100
commit95bdd977686005d3d813eb09aca625384f1774c1 (patch)
tree6d80a57751e2b9af75824e5b0e5bd1a53819b226 /core/io/tcp_server.cpp
parent311f1f165be12ea290799e42f9951011d997ab40 (diff)
downloadredot-engine-95bdd977686005d3d813eb09aca625384f1774c1.tar.gz
Use an instance variable for ip_type in raw sockets
PacketPeerUDP/StreamPeerTCP/TCP_Server now uses an instance variable to store the selected ip_type (IPv4/IPv6/ANY, where ANY = dual stack). All calls to resolve addresses, sending/receving data, connecting/listening will use that socket type.
Diffstat (limited to 'core/io/tcp_server.cpp')
-rw-r--r--core/io/tcp_server.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index 894cccf691..29e8bd0c02 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -46,19 +46,19 @@ TCP_Server* TCP_Server::create() {
return _create();
}
-Error TCP_Server::_listen(uint16_t p_port, IP_Address::AddrType p_type, DVector<String> p_accepted_hosts) {
+Error TCP_Server::_listen(uint16_t p_port, DVector<String> p_accepted_hosts) {
List<String> hosts;
for(int i=0;i<p_accepted_hosts.size();i++)
hosts.push_back(p_accepted_hosts.get(i));
- return listen(p_port,p_type, hosts.size()?&hosts:NULL);
+ return listen(p_port, hosts.size()?&hosts:NULL);
}
void TCP_Server::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("listen","port","ip_type", "accepted_hosts"),&TCP_Server::_listen,DEFVAL(IP_Address::TYPE_ANY),DEFVAL(DVector<String>()));
+ ObjectTypeDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>()));
ObjectTypeDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available);
ObjectTypeDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection);
ObjectTypeDB::bind_method(_MD("stop"),&TCP_Server::stop);
@@ -68,4 +68,5 @@ void TCP_Server::_bind_methods() {
TCP_Server::TCP_Server()
{
+ ip_type = IP_Address::TYPE_ANY;
}