socket: Remove datapath::error from on_close

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2019-01-06 23:42:21 +01:00
parent 18c772fafb
commit 6626a5441b
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ namespace datapath {
public /*events*/:
datapath::event<const std::vector<char>&> on_message;
datapath::event<datapath::error> on_close;
datapath::event<> on_close;
public:
virtual bool good() = 0;
+5 -4
View File
@@ -40,7 +40,7 @@ void datapath::windows::socket::_connect(HANDLE handle)
void datapath::windows::socket::_disconnect()
{
if (this->on_close) {
this->on_close(datapath::error::Closed);
this->on_close();
}
{
@@ -127,7 +127,8 @@ void datapath::windows::socket::_watcher()
// Read content.
if (ReadFileEx(this->socket_handle, read_buffer.data(), DWORD(read_buffer.size()),
read_header_ov->get_overlapped(), NULL)) {
read_header_ov->get_overlapped(),
&datapath::windows::utility::def_io_completion_routine)) {
state = readstate::Header;
waitable = read_header_ov;
@@ -192,8 +193,8 @@ datapath::error datapath::windows::socket::write(std::shared_ptr<datapath::itask
obj->_assign(data, ov);
BOOL suc =
WriteFileEx(socket_handle, obj->data().data(), DWORD(obj->data().size()), ov->get_overlapped(), NULL);
BOOL suc = WriteFileEx(socket_handle, obj->data().data(), DWORD(obj->data().size()), ov->get_overlapped(),
&datapath::windows::utility::def_io_completion_routine);
if (suc) {
return datapath::error::Success;
} else {
+1 -1
View File
@@ -32,7 +32,7 @@ extern "C" {
namespace datapath {
namespace windows {
class socket : public isocket {
class socket : public isocket, public std::enable_shared_from_this<datapath::windows::socket> {
bool is_connected;
HANDLE socket_handle;