Commit eeb7f6d3 authored by Vysheng's avatar Vysheng

Fixed bug in trees, causing fails

parent d8aaf0c8
...@@ -51,7 +51,6 @@ double get_double_time (void) { ...@@ -51,7 +51,6 @@ double get_double_time (void) {
} }
struct query *query_get (long long id) { struct query *query_get (long long id) {
tree_check_query (queries_tree);
return tree_lookup_query (queries_tree, (void *)&id); return tree_lookup_query (queries_tree, (void *)&id);
} }
...@@ -105,7 +104,6 @@ struct query *send_query (struct dc *DC, int ints, void *data, struct query_meth ...@@ -105,7 +104,6 @@ struct query *send_query (struct dc *DC, int ints, void *data, struct query_meth
void query_ack (long long id) { void query_ack (long long id) {
struct query *q = query_get (id); struct query *q = query_get (id);
if (q && !(q->flags & QUERY_ACK_RECEIVED)) { if (q && !(q->flags & QUERY_ACK_RECEIVED)) {
tree_check_query (queries_tree);
assert (q->msg_id == id); assert (q->msg_id == id);
q->flags |= QUERY_ACK_RECEIVED; q->flags |= QUERY_ACK_RECEIVED;
remove_event_timer (&q->ev); remove_event_timer (&q->ev);
...@@ -213,18 +211,14 @@ void insert_event_timer (struct event_timer *ev) { ...@@ -213,18 +211,14 @@ void insert_event_timer (struct event_timer *ev) {
if (verbosity > 2) { if (verbosity > 2) {
logprintf ( "INSERT: %lf %p %p\n", ev->timeout, ev->self, ev->alarm); logprintf ( "INSERT: %lf %p %p\n", ev->timeout, ev->self, ev->alarm);
} }
tree_check_timer (timer_tree);
timer_tree = tree_insert_timer (timer_tree, ev, lrand48 ()); timer_tree = tree_insert_timer (timer_tree, ev, lrand48 ());
tree_check_timer (timer_tree);
} }
void remove_event_timer (struct event_timer *ev) { void remove_event_timer (struct event_timer *ev) {
if (verbosity > 2) { if (verbosity > 2) {
logprintf ( "REMOVE: %lf %p %p\n", ev->timeout, ev->self, ev->alarm); logprintf ( "REMOVE: %lf %p %p\n", ev->timeout, ev->self, ev->alarm);
} }
tree_check_timer (timer_tree);
timer_tree = tree_delete_timer (timer_tree, ev); timer_tree = tree_delete_timer (timer_tree, ev);
tree_check_timer (timer_tree);
} }
double next_timer_in (void) { double next_timer_in (void) {
......
...@@ -101,7 +101,12 @@ struct tree_ ## X_NAME *tree_delete_ ## X_NAME (struct tree_ ## X_NAME *T, X_TYP ...@@ -101,7 +101,12 @@ struct tree_ ## X_NAME *tree_delete_ ## X_NAME (struct tree_ ## X_NAME *T, X_TYP
delete_tree_node_ ## X_NAME (T);\ delete_tree_node_ ## X_NAME (T);\
return N;\ return N;\
} else {\ } else {\
return tree_delete_ ## X_NAME (c < 0 ? T->left : T->right, x);\ if (c < 0) { \
T->left = tree_delete_ ## X_NAME (T->left, x); \
} else { \
T->right = tree_delete_ ## X_NAME (T->right, x); \
} \
return T; \
}\ }\
}\ }\
\ \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment