Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
cc2fee5e
Commit
cc2fee5e
authored
Jul 17, 2016
by
Marcel Stör
Committed by
GitHub
Jul 17, 2016
Browse files
Seed CoAP message id, fixes #847 (#1401)
parent
0bbce6f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/coap/coap.c
View file @
cc2fee5e
...
...
@@ -98,7 +98,7 @@ int coap_buildToken(const coap_buffer_t *tokbuf, const coap_header_t *hdr, uint8
p
=
buf
+
4
;
if
((
hdr
->
tkl
>
0
)
&&
(
hdr
->
tkl
!=
tokbuf
->
len
))
return
COAP_ERR_UNSUPPORTED
;
if
(
hdr
->
tkl
>
0
)
c_memcpy
(
p
,
tokbuf
->
p
,
hdr
->
tkl
);
...
...
@@ -483,7 +483,7 @@ int coap_make_request(coap_rw_buffer_t *scratch, coap_packet_t *pkt, coap_msgtyp
if
(
uri
->
port
!=
COAP_DEFAULT_PORT
)
{
pkt
->
opts
[
pkt
->
numopts
].
num
=
COAP_OPTION_URI_PORT
;
res
=
coap_encode_var_bytes
(
scratch
->
p
,
uri
->
port
);
res
=
coap_encode_var_bytes
(
scratch
->
p
,
uri
->
port
);
pkt
->
opts
[
pkt
->
numopts
].
buf
.
len
=
res
;
pkt
->
opts
[
pkt
->
numopts
].
buf
.
p
=
scratch
->
p
;
scratch
->
p
+=
res
;
...
...
@@ -496,7 +496,7 @@ int coap_make_request(coap_rw_buffer_t *scratch, coap_packet_t *pkt, coap_msgtyp
}
if
(
uri
->
query
.
length
)
{
res
=
coap_split_query
(
scratch
,
pkt
,
uri
->
query
.
s
,
uri
->
query
.
length
);
res
=
coap_split_query
(
scratch
,
pkt
,
uri
->
query
.
s
,
uri
->
query
.
length
);
}
pkt
->
payload
.
p
=
payload
;
...
...
@@ -546,7 +546,7 @@ next:
void
coap_setup
(
void
)
{
message_id
=
(
unsigned
short
)
rand
();
// calculate only once
message_id
=
(
unsigned
short
)
os_
rand
om
();
// calculate only once
}
inline
int
...
...
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