summaryrefslogtreecommitdiff
path: root/core/io/udp_server.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:41:43 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 21:57:34 +0200
commit0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch)
tree198d4ff7665d89307f6ca2469fa38620a9eb1672 /core/io/udp_server.cpp
parent07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff)
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'core/io/udp_server.cpp')
-rw-r--r--core/io/udp_server.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/io/udp_server.cpp b/core/io/udp_server.cpp
index 40180dcb09..1d329daf8b 100644
--- a/core/io/udp_server.cpp
+++ b/core/io/udp_server.cpp
@@ -46,13 +46,15 @@ Error UDPServer::listen(uint16_t p_port, const IP_Address &p_bind_address) {
Error err;
IP::Type ip_type = IP::TYPE_ANY;
- if (p_bind_address.is_valid())
+ if (p_bind_address.is_valid()) {
ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+ }
err = _sock->open(NetSocket::TYPE_UDP, ip_type);
- if (err != OK)
+ if (err != OK) {
return ERR_CANT_CREATE;
+ }
_sock->set_blocking_enabled(false);
_sock->set_reuse_address_enabled(true);
@@ -76,8 +78,9 @@ bool UDPServer::is_listening() const {
bool UDPServer::is_connection_available() const {
ERR_FAIL_COND_V(!_sock.is_valid(), false);
- if (!_sock->is_open())
+ if (!_sock->is_open()) {
return false;
+ }
Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
return (err == OK);