]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/UdsOp.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / UdsOp.h
index 87667146c9ca29f975be473e40c000cef4b9e22c..61b96db373e7807218725c066805d6cb103ea792 100644 (file)
@@ -1,18 +1,22 @@
 /*
- * $Id$
- *
- * DEBUG: section 54    Interprocess Communication
+ * Copyright (C) 1996-2017 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.
  */
 
+/* DEBUG: section 54    Interprocess Communication */
+
 #ifndef SQUID_IPC_ASYNCUDSOP_H
 #define SQUID_IPC_ASYNCUDSOP_H
 
-
-#include "SquidString.h"
 #include "base/AsyncJob.h"
+#include "cbdata.h"
 #include "comm/forward.h"
+#include "ipc/FdNotes.h"
 #include "ipc/TypedMsgHdr.h"
+#include "SquidString.h"
 
 class CommTimeoutCbParams;
 class CommIoCbParams;
@@ -56,23 +60,29 @@ private:
 };
 
 /// converts human-readable filename path into UDS address
-extern struct sockaddr_un PathToAddress(const String &pathAddr);
-
-
+struct sockaddr_un PathToAddress(const String &pathAddr);
 
 // XXX: move UdsSender code to UdsSender.{cc,h}
 /// attempts to send an IPC message a few times, with a timeout
 class UdsSender: public UdsOp
 {
+    CBDATA_CLASS(UdsSender);
+
 public:
     UdsSender(const String& pathAddr, const TypedMsgHdr& aMessage);
 
 protected:
+    virtual void swanSong(); // UdsOp (AsyncJob) API
     virtual void start(); // UdsOp (AsyncJob) API
     virtual bool doneAll() const; // UdsOp (AsyncJob) API
     virtual void timedout(); // UdsOp API
 
 private:
+    void startSleep();
+    void cancelSleep();
+    static void DelayedRetry(void *data);
+    void delayedRetry();
+
     void write(); ///< schedule writing
     void wrote(const CommIoCbParams& params); ///< done writing or error
 
@@ -80,19 +90,19 @@ private:
     TypedMsgHdr message; ///< what to send
     int retries; ///< how many times to try after a write error
     int timeout; ///< total time to send the message
+    bool sleeping; ///< whether we are waiting to retry a failed write
     bool writing; ///< whether Comm started and did not finish writing
 
 private:
     UdsSender(const UdsSender&); // not implemented
     UdsSender& operator= (const UdsSender&); // not implemented
-
-    CBDATA_CLASS2(UdsSender);
 };
 
-
 void SendMessage(const String& toAddress, const TypedMsgHdr& message);
-
+/// import socket fd from another strand into our Comm state
+const Comm::ConnectionPointer & ImportFdIntoComm(const Comm::ConnectionPointer &conn, int socktype, int protocol, FdNoteId noteId);
 
 }
 
 #endif /* SQUID_IPC_ASYNCUDSOP_H */
+