0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

fix network error code

This commit is contained in:
Eliot Horowitz 2011-07-11 21:50:33 -04:00
parent 9dab4d8bb1
commit 7f3d1bf056

View File

@ -52,6 +52,16 @@ namespace mongo {
}
#else
string getAddrInfoStrError(int code) {
#if !defined(_WIN32)
return gai_strerror(code);
#else
/* gai_strerrorA is not threadsafe on windows. don't use it. */
return errnoWithDescription(code);
#endif
}
void disableNagle(int sock) {
int x = 1;
@ -177,7 +187,7 @@ namespace mongo {
const int buflen=128;
char buffer[buflen];
int ret = getnameinfo(raw(), addressSize, buffer, buflen, NULL, 0, NI_NUMERICHOST);
massert(13082, errnoWithDescription(ret), ret == 0);
massert(13082, getAddrInfoStrError(ret), ret == 0);
return buffer;
}