View previous topic :: View next topic |
Author |
Message |
zhuyie
Joined: 25 Jan 2012 Posts: 1
|
Posted: Wed Jan 25, 2012 3:31 am Post subject: 20110808 readnatpmpresponse bug |
|
|
VC2008 on Windows 7.
in natpmp.c line 197, after called recvfrom(...), i found errno==0 when @ERR==10035(WSAEWOULDBLOCK or EWOULDBLOCK), so the following switch/case will not working correctly. Is it a bug?
n = recvfrom(p->s, buf, sizeof(buf), 0,
(struct sockaddr *)&addr, &addrlen);
if(n<0)
switch(errno) {
/*case EAGAIN:*/
case EWOULDBLOCK:
n = NATPMP_TRYAGAIN;
break;
case ECONNREFUSED:
n = NATPMP_ERR_NOGATEWAYSUPPORT;
break;
default:
n = NATPMP_ERR_RECVFROM;
} |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Wed Jan 25, 2012 3:58 pm Post subject: Re: 20110808 readnatpmpresponse bug |
|
|
zhuyie wrote: | VC2008 on Windows 7.
in natpmp.c line 197, after called recvfrom(...), i found errno==0 when @ERR==10035(WSAEWOULDBLOCK or EWOULDBLOCK), so the following switch/case will not working correctly. Is it a bug?
n = recvfrom(p->s, buf, sizeof(buf), 0,
(struct sockaddr *)&addr, &addrlen);
if(n<0)
switch(errno) {
/*case EAGAIN:*/
case EWOULDBLOCK:
n = NATPMP_TRYAGAIN;
break;
case ECONNREFUSED:
n = NATPMP_ERR_NOGATEWAYSUPPORT;
break;
default:
n = NATPMP_ERR_RECVFROM;
} |
Under Window the code should be different and use WSAGetLastError() instead of errno. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
© 2007 Thomas Bernard, author of MiniUPNP.
|