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'.
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:
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);
/* 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);
debugs(50, 0, "commBind: Cannot bind socket FD " << s << " to " << fd_table[s].local_addr << ": " << xstrerror());
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
}
/**
}
if (flags & COMM_NONBLOCKING)
- if (commSetNonBlocking(new_socket) == Comm::ERROR) {
+ if (commSetNonBlocking(new_socket) == Comm::COMM_ERROR) {
comm_close(new_socket);
return -1;
}
else if (errno == EAFNOSUPPORT || errno == EINVAL)
return Comm::ERR_PROTOCOL;
else
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
address.toStr(F->ipaddr, MAX_IPSTRLEN);
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
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_
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
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;
// 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;
case Comm::SHUTDOWN:
return EVENT_IDLE;
- case Comm::ERROR:
+ case Comm::COMM_ERROR:
return EVENT_ERROR;
default:
typedef enum {
OK = 0,
- ERROR = -1,
+ COMM_ERROR = -1,
NOMESSAGE = -3,
TIMEOUT = -4,
SHUTDOWN = -5,
/* error during poll */
getCurrentTime();
PROF_stop(comm_check_incoming);
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
}
PROF_stop(comm_check_incoming);
PROF_stop(comm_check_incoming);
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
}
PROF_stop(comm_check_incoming);
getCurrentTime();
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
/* NOTREACHED */
}
assert(errno != EINVAL);
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
/* NOTREACHED */
}
examine_select(&readfds, &writefds);
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
/* NOTREACHED */
}
examine_select(&readfds, &writefds);
- return Comm::ERROR;
+ return Comm::COMM_ERROR;
/* NOTREACHED */
}
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;
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;
};
* 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.
*
* \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
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;
}
}
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;
}
}
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);
// 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
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 */
/* 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);
}
}
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);
}
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);
}
}
/* 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);
}
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;
}
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;
}
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()
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