From 5071f615f2b7962ebf35f0ea2bab1dd4cfb392c2 Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Mon, 10 Sep 2018 15:47:24 +0800 Subject: [PATCH] Fix bug in NBAcceptResult --- gsock.cpp | 8 +++++++- gsock.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gsock.cpp b/gsock.cpp index d5323bb..ed050a9 100644 --- a/gsock.cpp +++ b/gsock.cpp @@ -235,6 +235,11 @@ int vsock::setNonblocking() } } +bool vsock::isNonblocking() +{ + return _vp->nonblocking; +} + vsock::~vsock() { if(_vp) @@ -1040,7 +1045,8 @@ void NBAcceptResult::_impl::update() if (ret >= 0) { - *out_binding_sfd = sfd; + // This is a BUG!! Fixed. + *out_binding_sfd = ret; *out_binding_created = true; status = 2; } diff --git a/gsock.h b/gsock.h index 52dd537..078ee45 100644 --- a/gsock.h +++ b/gsock.h @@ -49,6 +49,7 @@ class vsock { public: int setNonblocking(); + bool isNonblocking(); protected: vsock(); vsock(const vsock&)=delete;