From: Amos Jeffries Date: Mon, 9 Jun 2014 13:18:48 +0000 (-0700) Subject: Revert rename of Comm::Flag ERROR X-Git-Tag: SQUID_3_5_0_1~187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ee57cbefd3f862b866e94b01019ef69304455ac;p=thirdparty%2Fsquid.git Revert rename of Comm::Flag ERROR 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'. --- diff --git a/src/CommCalls.h b/src/CommCalls.h index d430cb6cb3..b558fad333 100644 --- a/src/CommCalls.h +++ b/src/CommCalls.h @@ -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: diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index 982891c24a..617852b0d8 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -153,7 +153,7 @@ Adaptation::Icap::Xaction::dnsLookupDone(const ipcache_addrs *ia) CbcPointer 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); diff --git a/src/client_side.cc b/src/client_side.cc index 8d92fdd0a6..a9a5428c7e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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); diff --git a/src/comm.cc b/src/comm.cc index 271167f1b1..34b0ceb171 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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: diff --git a/src/comm/Flag.h b/src/comm/Flag.h index a6b9532530..4faaa565c7 100644 --- a/src/comm/Flag.h +++ b/src/comm/Flag.h @@ -6,7 +6,7 @@ namespace Comm typedef enum { OK = 0, - ERROR = -1, + COMM_ERROR = -1, NOMESSAGE = -3, TIMEOUT = -4, SHUTDOWN = -5, diff --git a/src/comm/ModDevPoll.cc b/src/comm/ModDevPoll.cc index 944ad53c7f..8cb265b930 100644 --- a/src/comm/ModDevPoll.cc +++ b/src/comm/ModDevPoll.cc @@ -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); diff --git a/src/comm/ModEpoll.cc b/src/comm/ModEpoll.cc index aac5158990..b97f1babf7 100644 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@ -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); diff --git a/src/comm/ModKqueue.cc b/src/comm/ModKqueue.cc index 0fecd72693..d3ea6d55b0 100644 --- a/src/comm/ModKqueue.cc +++ b/src/comm/ModKqueue.cc @@ -271,7 +271,7 @@ Comm::DoSelect(int msec) getCurrentTime(); - return Comm::ERROR; + return Comm::COMM_ERROR; /* NOTREACHED */ } diff --git a/src/comm/ModPoll.cc b/src/comm/ModPoll.cc index bf9c548266..2367634c04 100644 --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@ -445,7 +445,7 @@ Comm::DoSelect(int msec) assert(errno != EINVAL); - return Comm::ERROR; + return Comm::COMM_ERROR; /* NOTREACHED */ } diff --git a/src/comm/ModSelect.cc b/src/comm/ModSelect.cc index 87b113f75f..e704b367c8 100644 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@ -466,7 +466,7 @@ Comm::DoSelect(int msec) examine_select(&readfds, &writefds); - return Comm::ERROR; + return Comm::COMM_ERROR; /* NOTREACHED */ } diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index 0906791223..373a7b7521 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -460,7 +460,7 @@ Comm::DoSelect(int msec) examine_select(&readfds, &writefds); - return Comm::ERROR; + return Comm::COMM_ERROR; /* NOTREACHED */ } diff --git a/src/comm/Read.cc b/src/comm/Read.cc index aba2092ba5..2587d80a89 100644 --- a/src/comm/Read.cc +++ b/src/comm/Read.cc @@ -94,11 +94,11 @@ Comm::ReadNow(CommIoCbParams ¶ms, 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; }; diff --git a/src/comm/Read.h b/src/comm/Read.h index 77d89a4fbd..793c435705 100644 --- a/src/comm/Read.h +++ b/src/comm/Read.h @@ -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. diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index a5bc13690c..198a5204cd 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -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 diff --git a/src/comm/Write.cc b/src/comm/Write.cc index 436302aa11..76b0b3cb3c 100644 --- a/src/comm/Write.cc +++ b/src/comm/Write.cc @@ -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); } } diff --git a/src/ipc.cc b/src/ipc.cc index 93874697b5..23f102d738 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -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); } diff --git a/src/ipc_win32.cc b/src/ipc_win32.cc index f76d57bafa..a3a15c8d96 100644 --- a/src/ipc_win32.cc +++ b/src/ipc_win32.cc @@ -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; } diff --git a/src/tests/stub_comm.cc b/src/tests/stub_comm.cc index 57216f1c8b..789c34bbc8 100644 --- a/src/tests/stub_comm.cc +++ b/src/tests/stub_comm.cc @@ -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() diff --git a/src/tests/stub_libcomm.cc b/src/tests/stub_libcomm.cc index d86ea86bd0..2fac4c3c8d 100644 --- a/src/tests/stub_libcomm.cc +++ b/src/tests/stub_libcomm.cc @@ -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 ¶ms, SBuf &buf) STUB_RETVAL(Comm::ERROR) +Comm::Flag Comm::ReadNow(CommIoCbParams ¶ms, SBuf &buf) STUB_RETVAL(Comm::COMM_ERROR) void Comm::ReadCancel(int fd, AsyncCall::Pointer &callback) STUB //void Comm::HandleRead(int, void*) STUB