diff options
Diffstat (limited to 'core/io/packet_peer_udp.cpp')
-rw-r--r-- | core/io/packet_peer_udp.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index c4a6fd79a8..46accf420a 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -29,40 +29,38 @@ #include "packet_peer_udp.h" #include "io/ip.h" -PacketPeerUDP* (*PacketPeerUDP::_create)()=NULL; +PacketPeerUDP *(*PacketPeerUDP::_create)() = NULL; String PacketPeerUDP::_get_packet_ip() const { return get_packet_address(); } -Error PacketPeerUDP::_set_dest_address(const String& p_address, int p_port) { +Error PacketPeerUDP::_set_dest_address(const String &p_address, int p_port) { IP_Address ip; if (p_address.is_valid_ip_address()) { - ip=p_address; + ip = p_address; } else { - ip=IP::get_singleton()->resolve_hostname(p_address); + ip = IP::get_singleton()->resolve_hostname(p_address); if (!ip.is_valid()) return ERR_CANT_RESOLVE; } - set_dest_address(ip,p_port); + set_dest_address(ip, p_port); return OK; } void PacketPeerUDP::_bind_methods() { - ClassDB::bind_method(D_METHOD("listen:Error","port", "bind_address", "recv_buf_size"),&PacketPeerUDP::listen,DEFVAL("*"),DEFVAL(65536)); - ClassDB::bind_method(D_METHOD("close"),&PacketPeerUDP::close); - ClassDB::bind_method(D_METHOD("wait:Error"),&PacketPeerUDP::wait); - ClassDB::bind_method(D_METHOD("is_listening"),&PacketPeerUDP::is_listening); - ClassDB::bind_method(D_METHOD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip); + ClassDB::bind_method(D_METHOD("listen:Error", "port", "bind_address", "recv_buf_size"), &PacketPeerUDP::listen, DEFVAL("*"), DEFVAL(65536)); + ClassDB::bind_method(D_METHOD("close"), &PacketPeerUDP::close); + ClassDB::bind_method(D_METHOD("wait:Error"), &PacketPeerUDP::wait); + ClassDB::bind_method(D_METHOD("is_listening"), &PacketPeerUDP::is_listening); + ClassDB::bind_method(D_METHOD("get_packet_ip"), &PacketPeerUDP::_get_packet_ip); //ClassDB::bind_method(D_METHOD("get_packet_address"),&PacketPeerUDP::_get_packet_address); - ClassDB::bind_method(D_METHOD("get_packet_port"),&PacketPeerUDP::get_packet_port); - ClassDB::bind_method(D_METHOD("set_dest_address","host","port"),&PacketPeerUDP::_set_dest_address); - - + ClassDB::bind_method(D_METHOD("get_packet_port"), &PacketPeerUDP::get_packet_port); + ClassDB::bind_method(D_METHOD("set_dest_address", "host", "port"), &PacketPeerUDP::_set_dest_address); } Ref<PacketPeerUDP> PacketPeerUDP::create_ref() { @@ -72,14 +70,12 @@ Ref<PacketPeerUDP> PacketPeerUDP::create_ref() { return Ref<PacketPeerUDP>(_create()); } -PacketPeerUDP* PacketPeerUDP::create() { +PacketPeerUDP *PacketPeerUDP::create() { if (!_create) return NULL; return _create(); } -PacketPeerUDP::PacketPeerUDP() -{ - +PacketPeerUDP::PacketPeerUDP() { } |