Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
ALPACA
CASPER
katcp
Commits
1b2a65f4
Commit
1b2a65f4
authored
14 years ago
by
Marc Welz
Browse files
Options
Download
Email Patches
Plain Diff
Bugfix: retrieve the correct parse message from a notice (for callbacks)
parent
f67dddf2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
katcp/job.c
+13
-1
katcp/job.c
katcp/nonsense.c
+4
-0
katcp/nonsense.c
katcp/notice.c
+11
-6
katcp/notice.c
katcp/queue.c
+1
-1
katcp/queue.c
with
29 additions
and
8 deletions
+29
-8
katcp/job.c
+
13
-
1
View file @
1b2a65f4
...
...
@@ -686,6 +686,10 @@ static int field_job_katcp(struct katcp_dispatch *d, struct katcp_job *j)
struct
katcp_notice
*
n
;
struct
katcl_parse
*
p
;
struct
katcp_trap
*
kt
;
#ifdef DEBUG
int
i
;
char
*
tmp
;
#endif
while
((
result
=
have_katcl
(
j
->
j_line
))
>
0
){
...
...
@@ -695,7 +699,15 @@ static int field_job_katcp(struct katcp_dispatch *d, struct katcp_job *j)
}
#ifdef DEBUG
fprintf
(
stderr
,
"job: processing message starting with <%s ..>
\n
"
,
cmd
);
p
=
ready_katcl
(
j
->
j_line
);
fprintf
(
stderr
,
"job: processing message starting with <%s %s ...>
\n
"
,
cmd
,
arg_string_katcl
(
j
->
j_line
,
1
));
fprintf
(
stderr
,
"job: alt:"
);
for
(
i
=
0
;
(
tmp
=
get_string_parse_katcl
(
p
,
i
));
i
++
){
fprintf
(
stderr
,
" <%s>"
,
tmp
);
}
fprintf
(
stderr
,
"
\n
"
);
#endif
switch
(
cmd
[
0
]){
...
...
This diff is collapsed.
Click to expand it.
katcp/nonsense.c
+
4
-
0
View file @
1b2a65f4
...
...
@@ -2466,6 +2466,10 @@ int match_sensor_list_katcp(struct katcp_dispatch *d, struct katcp_notice *n, vo
units
=
get_string_parse_katcl
(
p
,
3
);
type
=
get_string_parse_katcl
(
p
,
4
);
#ifdef DEBUG
fprintf
(
stderr
,
"sensor: saw sensor %s, type %s
\n
"
,
name
,
type
);
#endif
if
((
name
==
NULL
)
||
(
description
==
NULL
)
||
(
type
==
NULL
)){
...
...
This diff is collapsed.
Click to expand it.
katcp/notice.c
+
11
-
6
View file @
1b2a65f4
...
...
@@ -601,16 +601,13 @@ void release_notice_katcp(struct katcp_dispatch *d, struct katcp_notice *n)
struct
katcl_parse
*
get_parse_notice_katcp
(
struct
katcp_dispatch
*
d
,
struct
katcp_notice
*
n
)
{
struct
katcl_parse
*
p
;
sane_notice_katcp
(
n
);
p
=
get_head_queue_katcl
(
n
->
n_queue
);
if
(
p
){
return
p
;
if
(
n
->
n_parse
){
return
n
->
n_parse
;
}
return
n
->
n_parse
;
return
get_head_queue_katcl
(
n
->
n_queue
)
;
#if 0
if(n->n_position < 0){
...
...
@@ -871,6 +868,10 @@ int run_notices_katcp(struct katcp_dispatch *d)
n
->
n_parse
=
NULL
;
}
#ifdef DEBUG
fprintf
(
stderr
,
"notice: notice %p triggered with %d messages and %d subscribers
\n
"
,
n
,
limit
,
n
->
n_count
);
#endif
/* WARNING: vague semantics ahead. What does it mean to only have woken a single call back which then clears the set of parse messages ? */
n
->
n_parse
=
remove_head_queue_katcl
(
n
->
n_queue
);
...
...
@@ -883,6 +884,10 @@ int run_notices_katcp(struct katcp_dispatch *d)
v
->
v_trigger
=
0
;
result
=
(
*
(
v
->
v_call
))(
v
->
v_client
,
n
,
v
->
v_data
);
#ifdef DEBUG
fprintf
(
stderr
,
"notice: notice %p callback[%d]=%p returns %d (parse=%p)
\n
"
,
n
,
k
,
v
->
v_call
,
result
,
n
->
n_parse
);
#endif
if
(
result
<=
0
){
dispatch_compact_notice_katcp
(
v
->
v_client
,
n
);
...
...
This diff is collapsed.
Click to expand it.
katcp/queue.c
+
1
-
1
View file @
1b2a65f4
...
...
@@ -130,7 +130,7 @@ int add_tail_queue_katcl(struct katcl_queue *q, struct katcl_parse *p)
}
#ifdef DEBUG
fprintf
(
stderr
,
"add queue: adding %p with ref %u
\n
"
,
p
,
p
->
p_refs
);
fprintf
(
stderr
,
"add queue: adding %p with ref %u
to queue %p of size %d
\n
"
,
p
,
p
->
p_refs
,
q
,
q
->
q_count
);
#endif
if
(
q
->
q_count
>=
q
->
q_size
){
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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