now working with libuv v1.32.x

This commit is contained in:
Michele Caini 2019-09-10 15:54:59 +02:00
parent 3264417f15
commit 6f6294ebc2
5 changed files with 20 additions and 6 deletions

View File

@ -16,7 +16,7 @@ endif()
# Project configuration
#
project(uvw VERSION 2.0.0)
project(uvw VERSION 2.1.0)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)

View File

@ -17,7 +17,7 @@ ExternalProject_Add(
ExternalProject_Add(
libuv
GIT_REPOSITORY https://github.com/libuv/libuv.git
GIT_TAG v1.31.0
GIT_TAG v1.32.0
SOURCE_DIR @LIBUV_DEPS_DIR@
CONFIGURE_COMMAND ""
BUILD_COMMAND ""

View File

@ -14,7 +14,7 @@ class UVMConan(ConanFile):
exports = "LICENSE"
exports_sources = "src/*"
no_copy_source = True
requires = "libuv/1.30.0@bincrafters/stable"
requires = "libuv/1.32.0@bincrafters/stable"
def package(self):
self.copy(pattern="LICENSE", dst="licenses")

View File

@ -26,8 +26,8 @@ struct CloseEvent {};
* Base type for all `uvw` handle types.
*/
template<typename T, typename U>
class Handle: public BaseHandle, public Resource<T, U>
{
class Handle: public BaseHandle, public Resource<T, U> {
protected:
static void closeCallback(uv_handle_t *handle) {
Handle<T, U> &ref = *(static_cast<T*>(handle->data));
auto ptr = ref.shared_from_this();
@ -36,7 +36,6 @@ class Handle: public BaseHandle, public Resource<T, U>
ref.publish(CloseEvent{});
}
protected:
static void allocCallback(uv_handle_t *, std::size_t suggested, uv_buf_t *buf) {
auto size = static_cast<unsigned int>(suggested);
*buf = uv_buf_init(new char[size], size);

View File

@ -251,6 +251,21 @@ public:
connect<I>(std::move(addr.ip), addr.port);
}
/**
* @brief Resets a TCP connection by sending a RST packet.
*
* This is accomplished by setting the `SO_LINGER` socket option with a
* linger interval of zero and then calling `close`.<br/>
* Due to some platform inconsistencies, mixing of `shutdown` and
* `closeReset` calls is not allowed.
*
* A CloseEvent event is emitted when the connection has been reset.<br/>
* An ErrorEvent event is emitted in case of errors.
*/
void closeReset() {
invoke(&uv_tcp_close_reset, get(), &this->closeCallback);
}
private:
enum { DEFAULT, FLAGS } tag;
unsigned int flags;