mirror of
https://github.com/Kiritow/GSock.git
synced 2024-03-22 13:10:51 +08:00
NBAcceptResult can stopAtEdge now
This commit is contained in:
parent
63998de4fc
commit
eaec590513
23
gsock.cpp
23
gsock.cpp
|
@ -522,6 +522,7 @@ void NBSendResult::_impl::update()
|
||||||
NBSendResult::NBSendResult() : _p(new _impl)
|
NBSendResult::NBSendResult() : _p(new _impl)
|
||||||
{
|
{
|
||||||
_p->status = 0;
|
_p->status = 0;
|
||||||
|
_p->stopAtEdge = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NBSendResult::setStopAtEdge(bool flag)
|
void NBSendResult::setStopAtEdge(bool flag)
|
||||||
|
@ -626,6 +627,7 @@ void NBRecvResult::_impl::update()
|
||||||
NBRecvResult::NBRecvResult() : _p(new _impl)
|
NBRecvResult::NBRecvResult() : _p(new _impl)
|
||||||
{
|
{
|
||||||
_p->status = 0;
|
_p->status = 0;
|
||||||
|
_p->stopAtEdge = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NBRecvResult::setStopAtEdge(bool flag)
|
void NBRecvResult::setStopAtEdge(bool flag)
|
||||||
|
@ -1026,6 +1028,8 @@ struct NBAcceptResult::_impl
|
||||||
{
|
{
|
||||||
int sfd;
|
int sfd;
|
||||||
|
|
||||||
|
bool stopAtEdge;
|
||||||
|
|
||||||
// For client use
|
// For client use
|
||||||
bool isv4;
|
bool isv4;
|
||||||
sockaddr_in saddr;
|
sockaddr_in saddr;
|
||||||
|
@ -1071,10 +1075,21 @@ void NBAcceptResult::_impl::update()
|
||||||
{
|
{
|
||||||
gerrno err = TranslateNativeErrToGErr(GetNativeErrCode());
|
gerrno err = TranslateNativeErrToGErr(GetNativeErrCode());
|
||||||
errcode = err;
|
errcode = err;
|
||||||
if (err == gerrno::InProgress || err == gerrno::WouldBlock || err == gerrno::Already)
|
if (err == gerrno::InProgress || err == gerrno::Already)
|
||||||
{
|
{
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
|
else if (err == gerrno::WouldBlock)
|
||||||
|
{
|
||||||
|
if (stopAtEdge)
|
||||||
|
{
|
||||||
|
status = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = 3;
|
status = 3;
|
||||||
|
@ -1087,6 +1102,12 @@ void NBAcceptResult::_impl::update()
|
||||||
NBAcceptResult::NBAcceptResult() : _sp(new _impl)
|
NBAcceptResult::NBAcceptResult() : _sp(new _impl)
|
||||||
{
|
{
|
||||||
_sp->status = 0;
|
_sp->status = 0;
|
||||||
|
_sp->stopAtEdge = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NBAcceptResult::stopAtEdge(bool flag)
|
||||||
|
{
|
||||||
|
_sp->stopAtEdge = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NBAcceptResult::isFinished()
|
bool NBAcceptResult::isFinished()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user