So, I just had an idea How would one go about forcefully closing a bufferevent correctly? I'm currently doing this:
This might be the reason the stuff is corrupted (dont know why I didnt think of this earlier, sorry!)bool Socket::Close() { if (!m_event) { sys_err("Tried to close socket while m_event is a nullptr"); return false; } evutil_socket_t fd = bufferevent_getfd(m_event); if (fd < 0) {sys_err("Tried to close socket while m_event is not connected (fd < 0)");return false; } if (evutil_closesocket(fd) < 0) { int err = evutil_socket_geterror(fd);sys_err("Closing the socket %d failed. %s errorcode (%d)", fd, evutil_socket_error_to_string(err), err);return false; } // Simulate EOf event so we can handle disconnect properly OnEvent(BEV_EVENT_EOF); return true; }
*********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
