diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-01-02 15:51:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-02 15:51:45 +0100 |
commit | 0b2771bd6561152cdb0e650538a572a242068f01 (patch) | |
tree | b44c1ab2d50f14521cb7d9cafcee37b551871c66 /core/io/tcp_server.cpp | |
parent | 6428ebd91faa757aff419e3f6d1ccc63b699dd11 (diff) | |
parent | d194e1c48e5d161f0310ee17e63f1951e2c50de6 (diff) | |
download | redot-engine-0b2771bd6561152cdb0e650538a572a242068f01.tar.gz |
Merge pull request #7271 from Faless/ipv6_cleanup
Fixes and improvementes for IPv6 implementation.
Diffstat (limited to 'core/io/tcp_server.cpp')
-rw-r--r-- | core/io/tcp_server.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 77a3d8331d..431b17321b 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -30,8 +30,6 @@ TCP_Server* (*TCP_Server::_create)()=NULL; -VARIANT_ENUM_CAST(IP_Address::AddrType); - Ref<TCP_Server> TCP_Server::create_ref() { if (!_create) @@ -46,19 +44,25 @@ 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::set_ip_type(IP::Type p_type) { + stop(); + ip_type = p_type; } 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("set_ip_type","ip_type"),&TCP_Server::set_ip_type); + 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 +72,5 @@ void TCP_Server::_bind_methods() { TCP_Server::TCP_Server() { + ip_type = IP::TYPE_ANY; } |