Moved fr::TcpSocket::shutdown to fr::Socket::shutdown
This commit is contained in:
parent
9db918c7c2
commit
7017b64a15
@ -135,6 +135,17 @@ namespace fr
|
|||||||
*/
|
*/
|
||||||
virtual int32_t get_socket_descriptor() const = 0;
|
virtual int32_t get_socket_descriptor() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Calls the shutdown syscall on the socket.
|
||||||
|
* So you can receive data but not send.
|
||||||
|
*
|
||||||
|
* This can be called on a blocking socket to force
|
||||||
|
* it to immediately return (you might want to do this if
|
||||||
|
* you're exiting and need the blocking socket to return).
|
||||||
|
*/
|
||||||
|
void shutdown();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string remote_address;
|
std::string remote_address;
|
||||||
bool is_blocking;
|
bool is_blocking;
|
||||||
|
|||||||
@ -91,16 +91,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
int32_t get_socket_descriptor() const override;
|
int32_t get_socket_descriptor() const override;
|
||||||
|
|
||||||
/*!
|
|
||||||
* Calls the shutdown syscall on the socket.
|
|
||||||
* So you can receive data but not send.
|
|
||||||
*
|
|
||||||
* This can be called on a blocking socket to force
|
|
||||||
* it to immediately return (you might want to do this if
|
|
||||||
* you're exiting and need the blocking socket to return).
|
|
||||||
*/
|
|
||||||
void shutdown();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string unprocessed_buffer;
|
std::string unprocessed_buffer;
|
||||||
std::unique_ptr<char[]> recv_buffer;
|
std::unique_ptr<char[]> recv_buffer;
|
||||||
|
|||||||
@ -80,4 +80,9 @@ namespace fr
|
|||||||
}
|
}
|
||||||
return Socket::Status::Success;
|
return Socket::Status::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Socket::shutdown()
|
||||||
|
{
|
||||||
|
::shutdown(get_socket_descriptor(), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -156,10 +156,4 @@ namespace fr
|
|||||||
{
|
{
|
||||||
return socket_descriptor;
|
return socket_descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcpSocket::shutdown()
|
|
||||||
{
|
|
||||||
::shutdown(socket_descriptor, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user