]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add a generic unbind_all_listeners() primitive
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2007 21:35:41 +0000 (22:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 4 Nov 2007 21:42:49 +0000 (22:42 +0100)
Most protocols will be able to share a single unbind_all_listeners()
primitive. Provide it in protocols.c.

include/proto/protocols.h
src/protocols.c

index c5efd0cad8fca6272965963111e2637543559f8a..cd54ec8ee0ff63ff07eb39e7593f9164a265a10b 100644 (file)
@@ -58,6 +58,12 @@ int disable_all_listeners(struct protocol *proto);
  */
 int unbind_listener(struct listener *listener);
 
+/* This function closes all listening sockets bound to the protocol <proto>,
+ * and the listeners end in LI_ASSIGNED state if they were higher. It does not
+ * detach them from the protocol. It always returns ERR_NONE.
+ */
+int unbind_all_listeners(struct protocol *proto);
+
 /* Delete a listener from its protocol's list of listeners. The listener's
  * state is automatically updated from LI_ASSIGNED to LI_INIT. The protocol's
  * number of listeners is updated. Note that the listener must have previously
index 294edefa708f167fcd14daa2facd341938becf20..70d04de4caae153408995ccdda4e44a20f0c9a8c 100644 (file)
@@ -100,6 +100,19 @@ int unbind_listener(struct listener *listener)
        return ERR_NONE;
 }
 
+/* This function closes all listening sockets bound to the protocol <proto>,
+ * and the listeners end in LI_ASSIGNED state if they were higher. It does not
+ * detach them from the protocol. It always returns ERR_NONE.
+ */
+int unbind_all_listeners(struct protocol *proto)
+{
+       struct listener *listener;
+
+       list_for_each_entry(listener, &proto->listeners, proto_list)
+               unbind_listener(listener);
+       return ERR_NONE;
+}
+
 /* Delete a listener from its protocol's list of listeners. The listener's
  * state is automatically updated from LI_ASSIGNED to LI_INIT. The protocol's
  * number of listeners is updated. Note that the listener must have previously