mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Make get_scheduler_state_string available to scheduler*.c
This commit is contained in:
parent
8797c8fbd3
commit
667f931177
@ -198,24 +198,6 @@ get_scheduler_type_string(scheduler_types_t type)
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns human readable string for the given channel scheduler state. */
|
||||
static const char *
|
||||
get_scheduler_state_string(int scheduler_state)
|
||||
{
|
||||
switch (scheduler_state) {
|
||||
case SCHED_CHAN_IDLE:
|
||||
return "IDLE";
|
||||
case SCHED_CHAN_WAITING_FOR_CELLS:
|
||||
return "WAITING_FOR_CELLS";
|
||||
case SCHED_CHAN_WAITING_TO_WRITE:
|
||||
return "WAITING_TO_WRITE";
|
||||
case SCHED_CHAN_PENDING:
|
||||
return "PENDING";
|
||||
default:
|
||||
return "(invalid)";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scheduler event callback; this should get triggered once per event loop
|
||||
* if any scheduling work was created during the event loop.
|
||||
@ -380,6 +362,24 @@ set_scheduler(void)
|
||||
* Functions that can only be accessed from scheduler*.c
|
||||
*****************************************************************************/
|
||||
|
||||
/** Returns human readable string for the given channel scheduler state. */
|
||||
const char *
|
||||
get_scheduler_state_string(int scheduler_state)
|
||||
{
|
||||
switch (scheduler_state) {
|
||||
case SCHED_CHAN_IDLE:
|
||||
return "IDLE";
|
||||
case SCHED_CHAN_WAITING_FOR_CELLS:
|
||||
return "WAITING_FOR_CELLS";
|
||||
case SCHED_CHAN_WAITING_TO_WRITE:
|
||||
return "WAITING_TO_WRITE";
|
||||
case SCHED_CHAN_PENDING:
|
||||
return "PENDING";
|
||||
default:
|
||||
return "(invalid)";
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper that logs channel scheduler_state changes. Use this instead of
|
||||
* setting scheduler_state directly. */
|
||||
void scheduler_set_channel_state(channel_t *chan, int new_state){
|
||||
|
@ -145,6 +145,7 @@ MOCK_DECL(void, scheduler_channel_has_waiting_cells, (channel_t *chan));
|
||||
*********************************/
|
||||
|
||||
void scheduler_set_channel_state(channel_t *chan, int new_state);
|
||||
const char *get_scheduler_state_string(int scheduler_state);
|
||||
|
||||
/* Triggers a BUG() and extra information with chan if available. */
|
||||
#define SCHED_BUG(cond, chan) \
|
||||
|
@ -627,11 +627,11 @@ kist_scheduler_run(void)
|
||||
log_debug(LD_SCHED,
|
||||
"We didn't flush anything on a chan that we think "
|
||||
"can write and wants to write. The channel's state is '%s' "
|
||||
"and in scheduler state %d. We're going to mark it as "
|
||||
"and in scheduler state '%s'. We're going to mark it as "
|
||||
"waiting_for_cells (as that's most likely the issue) and "
|
||||
"stop scheduling it this round.",
|
||||
channel_state_to_string(chan->state),
|
||||
chan->scheduler_state);
|
||||
get_scheduler_state_string(chan->scheduler_state));
|
||||
scheduler_set_channel_state(chan, SCHED_CHAN_WAITING_FOR_CELLS);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user