Skip to content

Commit

Permalink
Merge pull request #8 from mwichmann/ws-fix
Browse files Browse the repository at this point in the history
Fix for where WITH_TCP is defined, WITH_WS is not.
  • Loading branch information
dthaler authored Sep 13, 2018
2 parents fa8b2b9 + b497109 commit 5a16b17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/coap/pdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ int coap_add_token2(coap_pdu_t *pdu, size_t len, const unsigned char *data,
*/
int coap_add_token_to_empty_message(coap_pdu_t *pdu, size_t len, const unsigned char *data,
coap_transport_t transport);

/**
* Get token from coap header
*
Expand Down
4 changes: 4 additions & 0 deletions src/pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ coap_pdu_parse2(unsigned char *data, size_t length, coap_pdu_t *pdu,
switch (transport) {
case COAP_UDP:
break;
#if defined(WITH_TCP)
case COAP_TCP:
for (size_t i = 0 ; i < headerSize ; i++) {
pdu->transport_hdr->tcp.header_data[i] = data[i];
Expand Down Expand Up @@ -984,6 +985,8 @@ coap_pdu_parse2(unsigned char *data, size_t length, coap_pdu_t *pdu,
opt = ((unsigned char *) &(pdu->transport_hdr->tcp_32bit)) +
headerSize + tokenLength;
break;
#endif
#if defined(WITH_WS)
case COAP_WS:
for (size_t i = 0 ; i < headerSize ; i++) {
pdu->transport_hdr->ws.header_data[i] = data[i];
Expand All @@ -993,6 +996,7 @@ coap_pdu_parse2(unsigned char *data, size_t length, coap_pdu_t *pdu,
opt = ((unsigned char *) &(pdu->transport_hdr->ws)) +
headerSize + tokenLength;
break;
#endif
default:
printf("it has wrong type\n");
}
Expand Down

0 comments on commit 5a16b17

Please sign in to comment.