THRIFT-1524 TNonBlockingServer does not compile in Visual Studio 2010
Patch: Christian Taedcke
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1294824 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TNonblockingServer.cpp b/lib/cpp/src/server/TNonblockingServer.cpp
index 7d42a2e..1ade895 100644
--- a/lib/cpp/src/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/server/TNonblockingServer.cpp
@@ -944,12 +944,12 @@
nConnectionsDropped_++;
nTotalConnectionsDropped_++;
if (overloadAction_ == T_OVERLOAD_CLOSE_ON_ACCEPT) {
- close(clientSocket);
+ ::close(clientSocket);
return;
} else if (overloadAction_ == T_OVERLOAD_DRAIN_TASK_QUEUE) {
if (!drainPendingTask()) {
// Nothing left to discard, so we drop connection instead.
- close(clientSocket);
+ ::close(clientSocket);
return;
}
}
@@ -960,7 +960,7 @@
if ((flags = fcntl(clientSocket, F_GETFL, 0)) < 0 ||
fcntl(clientSocket, F_SETFL, flags | O_NONBLOCK) < 0) {
GlobalOutput.perror("thriftServerEventHandler: set O_NONBLOCK (fcntl) ", errno);
- close(clientSocket);
+ ::close(clientSocket);
return;
}
@@ -971,7 +971,7 @@
// Fail fast if we could not create a TConnection object
if (clientConnection == NULL) {
GlobalOutput.printf("thriftServerEventHandler: failed TConnection factory");
- close(clientSocket);
+ ::close(clientSocket);
return;
}
@@ -1059,7 +1059,7 @@
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, const_cast_sockopt(&one), sizeof(one));
if (::bind(s, res->ai_addr, res->ai_addrlen) == -1) {
- close(s);
+ ::close(s);
freeaddrinfo(res0);
throw TException("TNonblockingServer::serve() bind");
}
@@ -1080,7 +1080,7 @@
int flags;
if ((flags = fcntl(s, F_GETFL, 0)) < 0 ||
fcntl(s, F_SETFL, flags | O_NONBLOCK) < 0) {
- close(s);
+ ::close(s);
throw TException("TNonblockingServer::serve() O_NONBLOCK");
}
@@ -1106,7 +1106,7 @@
#endif
if (listen(s, LISTEN_BACKLOG) == -1) {
- close(s);
+ ::close(s);
throw TException("TNonblockingServer::serve() listen");
}
@@ -1267,7 +1267,7 @@
}
if (listenSocket_ >= 0) {
- if (0 != close(listenSocket_)) {
+ if (0 != ::close(listenSocket_)) {
GlobalOutput.perror("TNonblockingIOThread listenSocket_ close(): ",
errno);
}
@@ -1292,8 +1292,8 @@
}
if(evutil_make_socket_nonblocking(notificationPipeFDs_[0])<0 ||
evutil_make_socket_nonblocking(notificationPipeFDs_[1])<0) {
- close(notificationPipeFDs_[0]);
- close(notificationPipeFDs_[1]);
+ ::close(notificationPipeFDs_[0]);
+ ::close(notificationPipeFDs_[1]);
throw TException("TNonblockingServer::createNotificationPipe() O_NONBLOCK");
}
for (int i = 0; i < 2; ++i) {
@@ -1304,8 +1304,8 @@
#else
if (evutil_make_socket_closeonexec(notificationPipeFDs_[i]) < 0) {
#endif
- close(notificationPipeFDs_[0]);
- close(notificationPipeFDs_[1]);
+ ::close(notificationPipeFDs_[0]);
+ ::close(notificationPipeFDs_[1]);
throw TException("TNonblockingServer::createNotificationPipe() "
"FD_CLOEXEC");
}