miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

20110808 readnatpmpresponse bug

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp Bugs
View previous topic :: View next topic  
Author Message
zhuyie



Joined: 25 Jan 2012
Posts: 1

PostPosted: Wed Jan 25, 2012 3:31 am    Post subject: 20110808 readnatpmpresponse bug Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1500

PostPosted: Wed Jan 25, 2012 3:58 pm    Post subject: Re: 20110808 readnatpmpresponse bug Reply with quote

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.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.