Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
eeb7f6d3
Commit
eeb7f6d3
authored
Oct 25, 2013
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in trees, causing fails
parent
d8aaf0c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
queries.c
queries.c
+0
-6
tree.h
tree.h
+6
-1
No files found.
queries.c
View file @
eeb7f6d3
...
@@ -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
)
{
...
...
tree.h
View file @
eeb7f6d3
...
@@ -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; \
}\
}\
}\
}\
\
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment