summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Hallenius <redsymbzone@hotmail.com>2014-05-31 17:13:08 +0200
committerTheo Hallenius <redsymbzone@hotmail.com>2014-05-31 17:13:08 +0200
commit91aa645d8a6d3dfa4e92a7de37a6bee5b8c3b31a (patch)
tree7f7ca8715a00a46a71b25d7df0dea1265709bb79
parent6f0b4678e26c04abfc88c0226c803e78a108de98 (diff)
Return an error code when address/port already in use
-rw-r--r--drivers/unix/tcp_server_posix.cpp3
-rw-r--r--platform/windows/tcp_server_winsock.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp
index f91ad36ef9..dfcf479fc0 100644
--- a/drivers/unix/tcp_server_posix.cpp
+++ b/drivers/unix/tcp_server_posix.cpp
@@ -93,6 +93,9 @@ Error TCPServerPosix::listen(uint16_t p_port,const List<String> *p_accepted_host
close(sockfd);
ERR_FAIL_V(FAILED);
};
+ }
+ else {
+ return ERR_ALREADY_IN_USE;
};
if (listen_sockfd != -1) {
diff --git a/platform/windows/tcp_server_winsock.cpp b/platform/windows/tcp_server_winsock.cpp
index 7b35bcc7ad..e77ca6feaa 100644
--- a/platform/windows/tcp_server_winsock.cpp
+++ b/platform/windows/tcp_server_winsock.cpp
@@ -86,6 +86,9 @@ Error TCPServerWinsock::listen(uint16_t p_port,const List<String> *p_accepted_ho
closesocket(sockfd);
ERR_FAIL_V(FAILED);
};
+ }
+ else {
+ return ERR_ALREADY_IN_USE;
};
if (listen_sockfd != INVALID_SOCKET) {