]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add a generic delete_listener() primitive
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2007 21:26:05 +0000 (22:26 +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 delete_listener()
primitive. Provide it in protocols.c, and remove the specific
version from proto_uxst.

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

index dd5a40c5efd92aa7864603c77efc33f79668690f..642beb8cefc80a6e1ebeb08e0312d752599c1944 100644 (file)
@@ -28,7 +28,6 @@
 
 int uxst_event_accept(int fd);
 void uxst_add_listener(struct listener *listener);
-void uxst_del_listener(struct listener *listener);
 void process_uxst_stats(struct task *t, struct timeval *next);
 
 #endif /* _PROTO_PROTO_UXST_H */
index 353e4c441cfddece54778a82347b563f8dc9a891..c5efd0cad8fca6272965963111e2637543559f8a 100644 (file)
@@ -58,6 +58,13 @@ int disable_all_listeners(struct protocol *proto);
  */
 int unbind_listener(struct listener *listener);
 
+/* 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
+ * been unbound. This is the generic function to use to remove a listener.
+ */
+void delete_listener(struct listener *listener);
+
 /* Registers the protocol <proto> */
 void protocol_register(struct protocol *proto);
 
index ca00b3188fdbb2644b390c3a73a5ee1325bc0d3b..0b3f317fc2e9268477fe218df5a890ba8f8794fb 100644 (file)
@@ -310,21 +310,6 @@ void uxst_add_listener(struct listener *listener)
        proto_unix.nb_listeners++;
 }
 
-/* Delete a listener from the list of unix stream listeners. The listener's
- * state is automatically updated from LI_ASSIGNED to LI_INIT. The number of
- * listeners is updated. Note that the listener must have previously been
- * unbound. This is the function to use to remove a listener.
- */
-void uxst_del_listener(struct listener *listener)
-{
-       if (listener->state != LI_ASSIGNED)
-               return;
-       listener->state = LI_INIT;
-       LIST_DEL(&listener->proto_list);
-       proto_unix.nb_listeners--;
-}
-
-
 /********************************
  * 3) protocol-oriented functions
  ********************************/
index 3e118b822c8809ae1d231e35e08c86574aed5488..294edefa708f167fcd14daa2facd341938becf20 100644 (file)
@@ -100,6 +100,20 @@ int unbind_listener(struct 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
+ * been unbound. This is the generic function to use to remove a listener.
+ */
+void delete_listener(struct listener *listener)
+{
+       if (listener->state != LI_ASSIGNED)
+               return;
+       listener->state = LI_INIT;
+       LIST_DEL(&listener->proto_list);
+       listener->proto->nb_listeners--;
+}
+
 /* Registers the protocol <proto> */
 void protocol_register(struct protocol *proto)
 {