Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
ba563588
Commit
ba563588
authored
7 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
net/gcoap: make gcoap_op_state return count directly
parent
cd410910
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/gcoap/gcoap_cli.c
+1
-2
1 addition, 2 deletions
examples/gcoap/gcoap_cli.c
sys/include/net/gcoap.h
+2
-2
2 additions, 2 deletions
sys/include/net/gcoap.h
sys/net/application_layer/coap/gcoap.c
+3
-5
3 additions, 5 deletions
sys/net/application_layer/coap/gcoap.c
with
6 additions
and
9 deletions
examples/gcoap/gcoap_cli.c
+
1
−
2
View file @
ba563588
...
...
@@ -165,8 +165,7 @@ int gcoap_cli_cmd(int argc, char **argv)
if
(
strcmp
(
argv
[
1
],
"info"
)
==
0
)
{
if
(
argc
==
2
)
{
uint8_t
open_reqs
;
gcoap_op_state
(
&
open_reqs
);
uint8_t
open_reqs
=
gcoap_op_state
();
printf
(
"CoAP server is listening on port %u
\n
"
,
GCOAP_PORT
);
printf
(
" CLI requests sent: %u
\n
"
,
req_count
);
...
...
This diff is collapsed.
Click to expand it.
sys/include/net/gcoap.h
+
2
−
2
View file @
ba563588
...
...
@@ -407,9 +407,9 @@ static inline ssize_t gcoap_response(coap_pkt_t *pdu, uint8_t *buf, size_t len,
*
* Useful for monitoring.
*
* @
param[out] open_reqs C
ount of unanswered requests
* @
return c
ount of unanswered requests
*/
void
gcoap_op_state
(
uint8_t
*
open_reqs
);
uint8_t
gcoap_op_state
(
void
);
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
sys/net/application_layer/coap/gcoap.c
+
3
−
5
View file @
ba563588
...
...
@@ -109,9 +109,7 @@ static void _listen(sock_udp_t *sock)
uint8_t
buf
[
GCOAP_PDU_BUF_SIZE
];
sock_udp_ep_t
remote
;
gcoap_request_memo_t
*
memo
=
NULL
;
uint8_t
open_reqs
;
gcoap_op_state
(
&
open_reqs
);
uint8_t
open_reqs
=
gcoap_op_state
();
ssize_t
res
=
sock_udp_recv
(
sock
,
buf
,
sizeof
(
buf
),
open_reqs
>
0
?
GCOAP_RECV_TIMEOUT
:
SOCK_NO_TIMEOUT
,
...
...
@@ -520,7 +518,7 @@ int gcoap_resp_init(coap_pkt_t *pdu, uint8_t *buf, size_t len, unsigned code)
return
0
;
}
void
gcoap_op_state
(
uint8_t
*
open_reqs
)
uint8_t
gcoap_op_state
(
void
)
{
uint8_t
count
=
0
;
for
(
int
i
=
0
;
i
<
GCOAP_REQ_WAITING_MAX
;
i
++
)
{
...
...
@@ -528,7 +526,7 @@ void gcoap_op_state(uint8_t *open_reqs)
count
++
;
}
}
*
open_reqs
=
count
;
return
count
;
}
/** @} */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment