Browse Source

sched: Groundwork before KIST implementation

- HT_FOREACH_FN defined in an additional place because nickm did that
  in an old kist prototype
- Make channel_more_to_flush mockable for future sched tests
- Add empty scheduler_{vanilla,kist}.c files and put in include.am

Signed-off-by: David Goulet <dgoulet@torproject.org>
Matt Traudt 6 years ago
parent
commit
2034e0d1d4
6 changed files with 17 additions and 3 deletions
  1. 2 0
      src/ext/ht.h
  2. 2 2
      src/or/channel.c
  3. 1 1
      src/or/channel.h
  4. 2 0
      src/or/include.am
  5. 5 0
      src/or/scheduler_kist.c
  6. 5 0
      src/or/scheduler_vanilla.c

+ 2 - 0
src/ext/ht.h

@@ -150,6 +150,8 @@
 #define HT_CLEAR(name, head)         name##_HT_CLEAR(head)
 #define HT_INIT(name, head)          name##_HT_INIT(head)
 #define HT_REP_IS_BAD_(name, head)    name##_HT_REP_IS_BAD_(head)
+#define HT_FOREACH_FN(name, head, fn, data) \
+   name##_HT_FOREACH_FN((head), (fn), (data))
 /* Helper: */
 static inline unsigned
 ht_improve_hash(unsigned h)

+ 2 - 2
src/or/channel.c

@@ -2601,8 +2601,8 @@ channel_flush_cells(channel_t *chan)
  * available.
  */
 
-int
-channel_more_to_flush(channel_t *chan)
+MOCK_IMPL(int,
+channel_more_to_flush, (channel_t *chan))
 {
   tor_assert(chan);
 

+ 1 - 1
src/or/channel.h

@@ -568,7 +568,7 @@ MOCK_DECL(ssize_t, channel_flush_some_cells,
           (channel_t *chan, ssize_t num_cells));
 
 /* Query if data available on this channel */
-int channel_more_to_flush(channel_t *chan);
+MOCK_DECL(int, channel_more_to_flush, (channel_t *chan));
 
 /* Notify flushed outgoing for dirreq handling */
 void channel_notify_flushed(channel_t *chan);

+ 2 - 0
src/or/include.am

@@ -99,6 +99,8 @@ LIBTOR_A_SOURCES = \
 	src/or/routerparse.c				\
 	src/or/routerset.c				\
 	src/or/scheduler.c				\
+	src/or/scheduler_kist.c				\
+	src/or/scheduler_vanilla.c			\
 	src/or/statefile.c				\
 	src/or/status.c					\
 	src/or/torcert.c				\

+ 5 - 0
src/or/scheduler_kist.c

@@ -0,0 +1,5 @@
+/* Copyright (c) 2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#include "scheduler.h"
+

+ 5 - 0
src/or/scheduler_vanilla.c

@@ -0,0 +1,5 @@
+/* Copyright (c) 2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#include "scheduler.h"
+