]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Revert rename of Comm::Flag ERROR
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 9 Jun 2014 13:18:48 +0000 (06:18 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 9 Jun 2014 13:18:48 +0000 (06:18 -0700)
On MinGW at least ERROR is a #define'd macro resulting in build failure.
Revert to the old name COMM_ERROR until we can find a better one that
does not duplicate 'comm'.

19 files changed:
src/CommCalls.h
src/adaptation/icap/Xaction.cc
src/client_side.cc
src/comm.cc
src/comm/Flag.h
src/comm/ModDevPoll.cc
src/comm/ModEpoll.cc
src/comm/ModKqueue.cc
src/comm/ModPoll.cc
src/comm/ModSelect.cc
src/comm/ModSelectWin32.cc
src/comm/Read.cc
src/comm/Read.h
src/comm/TcpAcceptor.cc
src/comm/Write.cc
src/ipc.cc
src/ipc_win32.cc
src/tests/stub_comm.cc
src/tests/stub_libcomm.cc

index d430cb6cb3eb594501ab666a2f5019569e1ee9c2..b558fad3335637595e35380effcca8303292268f 100644 (file)
@@ -77,7 +77,7 @@ public:
     Comm::ConnectionPointer conn;
 
     Comm::Flag flag;  ///< comm layer result status.
-    int xerrno;      ///< The last errno to occur. non-zero if flag is Comm::ERROR.
+    int xerrno;      ///< The last errno to occur. non-zero if flag is Comm::COMM_ERROR.
 
     int fd; ///< FD which the call was about. Set by the async call creator.
 private:
index 982891c24aee2db585aa863cde018a398e1883a7..617852b0d8454866520f98e57c8d94b5e1d8a879 100644 (file)
@@ -153,7 +153,7 @@ Adaptation::Icap::Xaction::dnsLookupDone(const ipcache_addrs *ia)
         CbcPointer<Xaction> self(this);
         Dialer dialer(self, &Adaptation::Icap::Xaction::noteCommConnected);
         dialer.params.conn = connection;
-        dialer.params.flag = Comm::ERROR;
+        dialer.params.flag = Comm::COMM_ERROR;
         // fake other parameters by copying from the existing connection
         connector = asyncCall(93,3, "Adaptation::Icap::Xaction::noteCommConnected", dialer);
         ScheduleCallHere(connector);
index 8d92fdd0a68872e772ec8d72720c559133f93158..a9a5428c7ef4b3cfc4d86489d87136afb53e62c6 100644 (file)
@@ -3030,7 +3030,7 @@ ConnStateData::clientReadRequest(const CommIoCbParams &io)
         /* Continue to process previously read data */
         break;
 
-        // case Comm::ERROR:
+        // case Comm::COMM_ERROR:
     default: // no other flags should ever occur
         debugs(33, 2, io.conn << ": got flag " << rd.flag << "; " << xstrerr(rd.xerrno));
         notifyAllContexts(rd.xerrno);
index 271167f1b15d15f1a585d9dea7380d511b420055..34b0ceb1714107f954207e7b9c526b5b111b60b2 100644 (file)
@@ -231,7 +231,7 @@ commBind(int s, struct addrinfo &inaddr)
 
     debugs(50, 0, "commBind: Cannot bind socket FD " << s << " to " << fd_table[s].local_addr << ": " << xstrerror());
 
-    return Comm::ERROR;
+    return Comm::COMM_ERROR;
 }
 
 /**
@@ -511,7 +511,7 @@ comm_apply_flags(int new_socket,
     }
 
     if (flags & COMM_NONBLOCKING)
-        if (commSetNonBlocking(new_socket) == Comm::ERROR) {
+        if (commSetNonBlocking(new_socket) == Comm::COMM_ERROR) {
             comm_close(new_socket);
             return -1;
         }
@@ -730,7 +730,7 @@ comm_connect_addr(int sock, const Ip::Address &address)
     else if (errno == EAFNOSUPPORT || errno == EINVAL)
         return Comm::ERR_PROTOCOL;
     else
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
 
     address.toStr(F->ipaddr, MAX_IPSTRLEN);
 
@@ -1004,7 +1004,7 @@ comm_udp_sendto(int fd,
 
         debugs(50, DBG_IMPORTANT, "comm_udp_sendto: FD " << fd << ", (family=" << fd_table[fd].sock_family << ") " << to_addr << ": " << xstrerror());
 
-    return Comm::ERROR;
+    return Comm::COMM_ERROR;
 }
 
 void
@@ -1129,7 +1129,7 @@ commSetNonBlocking(int fd)
 
         if (ioctl(fd, FIONBIO, &nonblocking) < 0) {
             debugs(50, 0, "commSetNonBlocking: FD " << fd << ": " << xstrerror() << " " << fd_table[fd].type);
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
         }
 
 #if _SQUID_CYGWIN_
@@ -1140,12 +1140,12 @@ commSetNonBlocking(int fd)
 
         if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
             debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
         }
 
         if (fcntl(fd, F_SETFL, flags | SQUID_NONBLOCK) < 0) {
             debugs(50, 0, "commSetNonBlocking: FD " << fd << ": " << xstrerror());
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
         }
 
 #endif
@@ -1170,13 +1170,13 @@ commUnsetNonBlocking(int fd)
 
     if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
         debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
     }
 
     if (fcntl(fd, F_SETFL, flags & (~SQUID_NONBLOCK)) < 0) {
 #endif
         debugs(50, 0, "commUnsetNonBlocking: FD " << fd << ": " << xstrerror());
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
     }
 
     fd_table[fd].flags.nonblocking = false;
@@ -1611,7 +1611,7 @@ checkTimeouts(void)
             // We have an active write callback and we are timed out
             debugs(5, 5, "checkTimeouts: FD " << fd << " auto write timeout");
             Comm::SetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
-            COMMIO_FD_WRITECB(fd)->finish(Comm::ERROR, ETIMEDOUT);
+            COMMIO_FD_WRITECB(fd)->finish(Comm::COMM_ERROR, ETIMEDOUT);
         } else if (AlreadyTimedOut(F))
             continue;
 
@@ -1883,7 +1883,7 @@ CommSelectEngine::checkEvents(int timeout)
     case Comm::SHUTDOWN:
         return EVENT_IDLE;
 
-    case Comm::ERROR:
+    case Comm::COMM_ERROR:
         return EVENT_ERROR;
 
     default:
index a6b9532530cc2db5901cb0d852c4e4db93cb4fea..4faaa565c74f06e17e05e1a8c682b024c71746b8 100644 (file)
@@ -6,7 +6,7 @@ namespace Comm
 
 typedef enum {
     OK = 0,
-    ERROR = -1,
+    COMM_ERROR = -1,
     NOMESSAGE = -3,
     TIMEOUT = -4,
     SHUTDOWN = -5,
index 944ad53c7fec163898061f261399b1bb6dca1128..8cb265b9302224f1dfe35cf227d795c48bc29ca9 100644 (file)
@@ -366,7 +366,7 @@ Comm::DoSelect(int msec)
         /* error during poll */
         getCurrentTime();
         PROF_stop(comm_check_incoming);
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
     }
 
     PROF_stop(comm_check_incoming);
index aac515899035de495b854299f97a89a77f878be2..b97f1babf7a617f728a722582959f905ccf7ee94 100644 (file)
@@ -267,7 +267,7 @@ Comm::DoSelect(int msec)
 
         PROF_stop(comm_check_incoming);
 
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
     }
 
     PROF_stop(comm_check_incoming);
index 0fecd72693cda0f19dffe4668b72089fb440c881..d3ea6d55b0f1a4162ea6f53a1642e03bac806861 100644 (file)
@@ -271,7 +271,7 @@ Comm::DoSelect(int msec)
 
         getCurrentTime();
 
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
 
         /* NOTREACHED */
     }
index bf9c548266cfc5b4ea0d5abc4b0d531c58b6002e..2367634c0462fde8076fa2aca319a5c5d98ca183 100644 (file)
@@ -445,7 +445,7 @@ Comm::DoSelect(int msec)
 
             assert(errno != EINVAL);
 
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
 
             /* NOTREACHED */
         }
index 87b113f75fb197b07664ed0b637a7a61cb31c9cd..e704b367c8fc741e2fe43871b1eb5dff34be7493 100644 (file)
@@ -466,7 +466,7 @@ Comm::DoSelect(int msec)
 
             examine_select(&readfds, &writefds);
 
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
 
             /* NOTREACHED */
         }
index 09067912232dfbc84303abb4f2f5912946de4910..373a7b7521a4b1531621196d4fcdf348dd98a0ab 100644 (file)
@@ -460,7 +460,7 @@ Comm::DoSelect(int msec)
 
             examine_select(&readfds, &writefds);
 
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
 
             /* NOTREACHED */
         }
index aba2092ba53e43f29bcd8f4da433c4202cd30341..2587d80a899db8bf35f484a8f651deae18c68076 100644 (file)
@@ -94,11 +94,11 @@ Comm::ReadNow(CommIoCbParams &params, SBuf &buf)
         params.flag = Comm::ENDFILE;
 
     } else if (retval < 0) { // connection errors are worst-case
-        debugs(5, 3, params.conn << " Comm::ERROR: " << xstrerr(params.xerrno));
+        debugs(5, 3, params.conn << " Comm::COMM_ERROR: " << xstrerr(params.xerrno));
         if (ignoreErrno(params.xerrno))
             params.flag =  Comm::INPROGRESS;
         else
-            params.flag =  Comm::ERROR;
+            params.flag =  Comm::COMM_ERROR;
     }
 
     return params.flag;
@@ -144,9 +144,9 @@ Comm::HandleRead(int fd, void *data)
         return;
 
     } else if (retval < 0 && !ignoreErrno(errno)) {
-        debugs(5, 3, "comm_read_try: scheduling Comm::ERROR");
+        debugs(5, 3, "comm_read_try: scheduling Comm::COMM_ERROR");
         ccb->offset = 0;
-        ccb->finish(Comm::ERROR, errno);
+        ccb->finish(Comm::COMM_ERROR, errno);
         return;
     };
 
index 77d89a4fbd0fb44e4eee8af9bae31257c73d6b0a..793c435705e2047a4f20b77737bd4cddb54719fc 100644 (file)
@@ -27,7 +27,7 @@ bool MonitorsRead(int fd);
  * The returned flag is also placed in params.flag.
  *
  * \retval Comm::OK          data has been read and placed in buf, amount in params.size
- * \retval Comm::ERROR       an error occured, the code is placed in params.xerrno
+ * \retval Comm::COMM_ERROR  an error occured, the code is placed in params.xerrno
  * \retval Comm::INPROGRESS  unable to read at this time, or a minor error occured
  * \retval Comm::ENDFILE     0-byte read has occured.
  *                           Usually indicates the remote end has disconnected.
index a5bc13690c955d2f97b73282fa6e51b73289b501..198a5204cd4335131cb213c6520c2e2a34d3ee52 100644 (file)
@@ -322,7 +322,7 @@ Comm::TcpAcceptor::notify(const Comm::Flag flag, const Comm::ConnectionPointer &
  *
  * \retval Comm::OK         success. details parameter filled.
  * \retval Comm::NOMESSAGE  attempted accept() but nothing useful came in.
- * \retval Comm::ERROR      an outright failure occured.
+ * \retval Comm::COMM_ERROR      an outright failure occured.
  *                         Or if this client has too many connections already.
  */
 Comm::Flag
@@ -347,10 +347,10 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details)
             return Comm::NOMESSAGE;
         } else if (ENFILE == errno || EMFILE == errno) {
             debugs(50, 3, HERE << status() << ": " << xstrerror());
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
         } else {
             debugs(50, DBG_IMPORTANT, HERE << status() << ": " << xstrerror());
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
         }
     }
 
@@ -362,7 +362,7 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details)
         if (clientdbEstablished(details->remote, 0) > Config.client_ip_max_connections) {
             debugs(50, DBG_IMPORTANT, "WARNING: " << details->remote << " attempting more than " << Config.client_ip_max_connections << " connections.");
             Ip::Address::FreeAddrInfo(gai);
-            return Comm::ERROR;
+            return Comm::COMM_ERROR;
         }
     }
 
@@ -372,7 +372,7 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details)
     if (getsockname(sock, gai->ai_addr, &gai->ai_addrlen) != 0) {
         debugs(50, DBG_IMPORTANT, "ERROR: getsockname() failed to locate local-IP on " << details << ": " << xstrerror());
         Ip::Address::FreeAddrInfo(gai);
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
     }
     details->local = *gai;
     Ip::Address::FreeAddrInfo(gai);
@@ -401,7 +401,7 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details)
     // Perform NAT or TPROXY operations to retrieve the real client/dest IP addresses
     if (conn->flags&(COMM_TRANSPARENT|COMM_INTERCEPTION) && !Ip::Interceptor.Lookup(details, conn)) {
         // Failed.
-        return Comm::ERROR;
+        return Comm::COMM_ERROR;
     }
 
 #if USE_SQUID_EUI
index 436302aa11c4f4577d420527ce6607f81dab8a85..76b0b3cb3c9d4890201e9e66d7a98210e5400204 100644 (file)
@@ -125,18 +125,18 @@ Comm::HandleWrite(int fd, void *data)
         if (nleft != 0)
             debugs(5, DBG_IMPORTANT, "FD " << fd << " write failure: connection closed with " << nleft << " bytes remaining.");
 
-        state->finish(nleft ? Comm::ERROR : Comm::OK, errno);
+        state->finish(nleft ? Comm::COMM_ERROR : Comm::OK, errno);
     } else if (len < 0) {
         /* An error */
         if (fd_table[fd].flags.socket_eof) {
             debugs(50, 2, HERE << "FD " << fd << " write failure: " << xstrerror() << ".");
-            state->finish(nleft ? Comm::ERROR : Comm::OK, errno);
+            state->finish(nleft ? Comm::COMM_ERROR : Comm::OK, errno);
         } else if (ignoreErrno(errno)) {
             debugs(50, 9, HERE << "FD " << fd << " write failure: " << xstrerror() << ".");
             state->selectOrQueueWrite();
         } else {
             debugs(50, 2, HERE << "FD " << fd << " write failure: " << xstrerror() << ".");
-            state->finish(nleft ? Comm::ERROR : Comm::OK, errno);
+            state->finish(nleft ? Comm::COMM_ERROR : Comm::OK, errno);
         }
     } else {
         /* A successful write, continue */
@@ -146,7 +146,7 @@ Comm::HandleWrite(int fd, void *data)
             /* Not done, reinstall the write handler and write some more */
             state->selectOrQueueWrite();
         } else {
-            state->finish(nleft ? Comm::OK : Comm::ERROR, errno);
+            state->finish(nleft ? Comm::OK : Comm::COMM_ERROR, errno);
         }
     }
 
index 93874697b5b2a2a96efd8bcb5dffddb11800a7f6..23f102d738b33eb3e8957d5ee5cabc30ae76ba28 100644 (file)
@@ -262,7 +262,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         cwfd = crfd = -1;
 
         if (type == IPC_TCP_SOCKET || type == IPC_UDP_SOCKET) {
-            if (comm_connect_addr(pwfd, ChS) == Comm::ERROR)
+            if (comm_connect_addr(pwfd, ChS) == Comm::COMM_ERROR)
                 return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
         }
 
@@ -334,7 +334,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         close(crfd);
         cwfd = crfd = fd;
     } else if (type == IPC_UDP_SOCKET) {
-        if (comm_connect_addr(crfd, PaS) == Comm::ERROR)
+        if (comm_connect_addr(crfd, PaS) == Comm::COMM_ERROR)
             return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
     }
 
index f76d57bafa1fcb1b0f25ffb7a4b985097e47b450..a3a15c8d966d08649e357a49c436a8a00db8d6be 100644 (file)
@@ -263,7 +263,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     }
 
     /* NP: tmp_addr was left with eiether empty or aiCS in Ip::Address format */
-    if (comm_connect_addr(pwfd, tmp_addr) == Comm::ERROR) {
+    if (comm_connect_addr(pwfd, tmp_addr) == Comm::COMM_ERROR) {
         CloseHandle((HANDLE) thread);
         return ipcCloseAllFD(prfd, pwfd, -1, -1);
     }
@@ -425,7 +425,7 @@ ipc_thread_1(void *in_params)
         fd_table[fd].flags.ipc = 1;
         cwfd = crfd = fd;
     } else if (type == IPC_UDP_SOCKET) {
-        if (comm_connect_addr(crfd, params->PS) == Comm::ERROR)
+        if (comm_connect_addr(crfd, params->PS) == Comm::COMM_ERROR)
             goto cleanup;
     }
 
@@ -512,14 +512,14 @@ ipc_thread_1(void *in_params)
 
         debugs(54, 3, "ipcCreate: FD " << crfd_ipc << " sockaddr " << CS_ipc);
 
-        if (comm_connect_addr(pwfd_ipc, CS_ipc) == Comm::ERROR) {
+        if (comm_connect_addr(pwfd_ipc, CS_ipc) == Comm::COMM_ERROR) {
             ipcSend(cwfd, err_string, strlen(err_string));
             goto cleanup;
         }
 
         fd = crfd;
 
-        if (comm_connect_addr(crfd_ipc, PS_ipc) == Comm::ERROR) {
+        if (comm_connect_addr(crfd_ipc, PS_ipc) == Comm::COMM_ERROR) {
             ipcSend(cwfd, err_string, strlen(err_string));
             goto cleanup;
         }
index 57216f1c8bf5b4aa47ec218261d62d3ff540e6b8..789c34bbc8e03e94c402ad6e4c20ef84b8fc3859 100644 (file)
@@ -55,7 +55,7 @@ void commSetCloseOnExec(int fd) STUB_NOP
 int ignoreErrno(int ierrno) STUB_RETVAL(-1)
 
 void commUnsetFdTimeout(int fd) STUB
-int commSetNonBlocking(int fd) STUB_RETVAL(Comm::ERROR)
+int commSetNonBlocking(int fd) STUB_RETVAL(Comm::COMM_ERROR)
 int commUnsetNonBlocking(int fd) STUB_RETVAL(-1)
 
 // MinGW needs also a stub of _comm_close()
index d86ea86bd003b521dc65091100eb9d88e0225a58..2fac4c3c8d7e9c6c65e7d69f1a553a5af2306802 100644 (file)
@@ -45,13 +45,13 @@ void Comm::CallbackTableDestruct() STUB
 void Comm::SelectLoopInit(void) STUB
 void Comm::SetSelect(int, unsigned int, PF *, void *, time_t) STUB
 void Comm::ResetSelect(int) STUB
-Comm::Flag Comm::DoSelect(int) STUB_RETVAL(Comm::ERROR)
+Comm::Flag Comm::DoSelect(int) STUB_RETVAL(Comm::COMM_ERROR)
 void Comm::QuickPollRequired(void) STUB
 
 #include "comm/Read.h"
 void Comm::Read(const Comm::ConnectionPointer &conn, AsyncCall::Pointer &callback) STUB
 bool Comm::MonitorsRead(int fd) STUB_RETVAL(false)
-Comm::Flag Comm::ReadNow(CommIoCbParams &params, SBuf &buf) STUB_RETVAL(Comm::ERROR)
+Comm::Flag Comm::ReadNow(CommIoCbParams &params, SBuf &buf) STUB_RETVAL(Comm::COMM_ERROR)
 void Comm::ReadCancel(int fd, AsyncCall::Pointer &callback) STUB
 //void Comm::HandleRead(int, void*) STUB