diff options
Diffstat (limited to 'drivers/unix/stream_peer_tcp_posix.cpp')
| -rw-r--r-- | drivers/unix/stream_peer_tcp_posix.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index ebcb060b7..ae4bf77c3 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -140,7 +140,7 @@ void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port, peer_port = p_port; }; -Error StreamPeerTCPPosix::connect(const IP_Address& p_host, uint16_t p_port) { +Error StreamPeerTCPPosix::connect_to_host(const IP_Address& p_host, uint16_t p_port) { ERR_FAIL_COND_V( p_host == IP_Address(), ERR_INVALID_PARAMETER); @@ -148,7 +148,7 @@ Error StreamPeerTCPPosix::connect(const IP_Address& p_host, uint16_t p_port) { sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP); if (sockfd == -1) { ERR_PRINT("Socket creation failed!"); - disconnect(); + disconnect_from_host(); //perror("socket"); return FAILED; }; @@ -167,7 +167,7 @@ Error StreamPeerTCPPosix::connect(const IP_Address& p_host, uint16_t p_port) { if (::connect(sockfd, (struct sockaddr *)&their_addr,addr_size) == -1 && errno != EINPROGRESS) { ERR_PRINT("Connection to remote host failed!"); - disconnect(); + disconnect_from_host(); return FAILED; }; @@ -219,7 +219,7 @@ Error StreamPeerTCPPosix::write(const uint8_t* p_data,int p_bytes, int &r_sent, if (errno != EAGAIN) { perror("shit?"); - disconnect(); + disconnect_from_host(); ERR_PRINT("Server disconnected!\n"); return FAILED; }; @@ -245,7 +245,7 @@ Error StreamPeerTCPPosix::write(const uint8_t* p_data,int p_bytes, int &r_sent, Error StreamPeerTCPPosix::read(uint8_t* p_buffer, int p_bytes,int &r_received, bool p_block) { - if (!is_connected()) { + if (!is_connected_to_host()) { return FAILED; }; @@ -276,7 +276,7 @@ Error StreamPeerTCPPosix::read(uint8_t* p_buffer, int p_bytes,int &r_received, b if (errno != EAGAIN) { perror("shit?"); - disconnect(); + disconnect_from_host(); ERR_PRINT("Server disconnected!\n"); return FAILED; }; @@ -310,12 +310,12 @@ Error StreamPeerTCPPosix::read(uint8_t* p_buffer, int p_bytes,int &r_received, b void StreamPeerTCPPosix::set_nodelay(bool p_enabled) { - ERR_FAIL_COND(!is_connected()); + ERR_FAIL_COND(!is_connected_to_host()); int flag=p_enabled?1:0; setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int)); } -bool StreamPeerTCPPosix::is_connected() const { +bool StreamPeerTCPPosix::is_connected_to_host() const { if (status == STATUS_NONE || status == STATUS_ERROR) { @@ -338,7 +338,7 @@ StreamPeerTCP::Status StreamPeerTCPPosix::get_status() const { }; -void StreamPeerTCPPosix::disconnect() { +void StreamPeerTCPPosix::disconnect_from_host() { if (sockfd != -1) close(sockfd); @@ -403,7 +403,7 @@ StreamPeerTCPPosix::StreamPeerTCPPosix() { StreamPeerTCPPosix::~StreamPeerTCPPosix() { - disconnect(); + disconnect_from_host(); }; #endif |
