]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/comm/Write.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / comm / Write.cc
index a9db6177dd92db519708f14aec3c8db91110e48b..4a853e20888e54488cb8e71f10dbbb374b72bde8 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #include "squid.h"
 #include "comm/Connection.h"
 #include "comm/IoCallback.h"
 #include "globals.h"
 #include "MemBuf.h"
 #include "profiler/Profiler.h"
-#include "protos.h"
 #include "SquidTime.h"
 #include "StatCounters.h"
-
 #if USE_DELAY_POOLS
 #include "ClientInfo.h"
 #endif
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
+
+#include <cerrno>
 
 void
 Comm::Write(const Comm::ConnectionPointer &conn, MemBuf *mb, AsyncCall::Pointer &callback)
@@ -128,18 +133,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 */
@@ -149,9 +154,10 @@ 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);
         }
     }
 
     PROF_stop(commHandleWrite);
 }
+