#endif
};
-#ifdef DEBUG_STATE_MACHINE
-#define TRACE_STATE_MACHINE if (debug_flag) do { struct timeval debug_tv; \
- gettimeofday(&debug_tv, NULL);\
- debug_tv.tv_sec -= fr_start_time;\
- printf("(%u) %d.%06d ********\tSTATE %s action %s live M-%s C-%s\t********\n",\
- request->number, (int) debug_tv.tv_sec, (int) debug_tv.tv_usec, __FUNCTION__, action_codes[action], master_state_names[request->master_state], child_state_names[request->child_state]); } while (0)
-
+#ifndef NDEBUG
static char const *master_state_names[REQUEST_MASTER_NUM_STATES] = {
"?",
"active",
"done"
};
+# define TRACE_STATE_MACHINE \
+ if (RDEBUG_ENABLED3) do { \
+ struct timeval debug_tv; \
+ gettimeofday(&debug_tv, NULL); \
+ debug_tv.tv_sec -= fr_start_time; \
+ RDEBUG3("%d.%06d ******** STATE %s action %s live M-%s C-%s ********\n", \
+ (int) debug_tv.tv_sec, (int) debug_tv.tv_usec, __FUNCTION__, action_codes[action], \
+ master_state_names[request->master_state], child_state_names[request->child_state]); \
+ } while (0)
#else
-#define TRACE_STATE_MACHINE {}
+# define TRACE_STATE_MACHINE {}
#endif
/*
}
#endif
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tSTATE %s C-%s -> C-%s\t********\n",
request->number, __FUNCTION__,
child_state_names[request->child_state],
* Set timer for when we need to clean it up.
*/
if (timercmp(&when, &now, >)) {
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tNEXT-STATE %s -> %s\n", request->number, __FUNCTION__, "request_cleanup_delay");
#endif
request->process = request_cleanup_delay;
{
struct timeval now, when;
rad_assert(request->magic == REQUEST_MAGIC);
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
int action = FR_ACTION_TIMER;
#endif
tv_add(&when, request->response_delay.tv_usec);
if (timercmp(&when, &now, >)) {
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tNEXT-STATE %s -> %s\n", request->number, __FUNCTION__, "request_response_delay");
#endif
STATE_MACHINE_TIMER(FR_ACTION_TIMER);
when.tv_sec += request->root->cleanup_delay;
if (timercmp(&when, &now, >)) {
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tNEXT-STATE %s -> %s\n", request->number, __FUNCTION__, "request_cleanup_delay");
#endif
STATE_MACHINE_TIMER(FR_ACTION_TIMER);
static void request_queue_or_run(REQUEST *request,
fr_request_process_t process)
{
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
int action = FR_ACTION_TIMER;
#endif
* it.
*/
if (request->master_state == REQUEST_STOP_PROCESSING) {
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tSTATE %s M-%s causes C-%s-> C-%s\t********\n",
request->number, __FUNCTION__,
master_state_names[request->master_state],
}
-static int CC_HINT(nonnull) request_pre_handler(REQUEST *request, UNUSED int action)
+static int CC_HINT(nonnull) request_pre_handler(REQUEST *request,
+#ifndef NDEBUG
+ int action
+#else
+ UNUSED int action
+#endif
+ )
{
int rcode;
case FR_ACTION_RUN:
if (!request_pre_handler(request, action)) {
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tSTATE %s failed in pre-handler C-%s -> C-%s\t********\n",
request->number, __FUNCTION__,
child_state_names[request->child_state],
*/
if ((action == FR_ACTION_RUN) &&
request_will_proxy(request)) {
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tWill Proxy\t********\n", request->number);
#endif
/*
} else
#endif
{
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tFinished\t********\n", request->number);
#endif
request->number = request_num_counter++;
request->priority = listener->type;
request->master_state = REQUEST_ACTIVE;
-#ifdef DEBUG_STATE_MACHINE
+#ifndef NDEBUG
if (debug_flag) printf("(%u) ********\tSTATE %s C-%s -> C-%s\t********\n",
request->number, __FUNCTION__,
child_state_names[request->child_state],
request->proxy->dst_ipaddr = home->ipaddr;
request->proxy->dst_port = home->port;
request->home_server = home;
-#ifdef DEBUG_STATE_MACHINE
- if (debug_flag) printf("(%u) ********\tSTATE %s C-%s -> C-%s\t********\n", request->number, __FUNCTION__,
- child_state_names[request->child_state],
- child_state_names[REQUEST_DONE]);
- if (debug_flag) printf("(%u) ********\tNEXT-STATE %s -> %s\n", request->number, __FUNCTION__, "request_ping");
+#ifndef NDEBUG
+ RDEBUG3("******** STATE %s C-%s -> C-%s ********", __FUNCTION__,
+ child_state_names[request->child_state],
+ child_state_names[REQUEST_DONE]);
+ RDEBUG3("******** NEXT-STATE %s -> %s", __FUNCTION__, "request_ping");
#endif
#ifdef HAVE_PTHREAD_H
rad_assert(request->child_pid == NO_SUCH_CHILD_PID);
coa->proxy_listener->encode(coa->proxy_listener, coa);
debug_packet(coa, coa->proxy, false);
-#ifdef DEBUG_STATE_MACHINE
- if (debug_flag) printf("(%u) ********\tSTATE %s C-%s -> C-%s\t********\n", request->number, __FUNCTION__,
- child_state_names[request->child_state],
- child_state_names[REQUEST_PROXIED]);
+#ifndef NDEBUG
+ RDEBUG3("******** STATE %s C-%s -> C-%s ********",__FUNCTION__,
+ child_state_names[request->child_state],
+ child_state_names[REQUEST_PROXIED]);
#endif
/*