Alleged race-condition was a bug in receiver
Handling put-requests was missing a trailing \0 in the parsed string.
This commit is contained in:
parent
16afb4b74c
commit
058ae7bae3
2 changed files with 4 additions and 13 deletions
|
@ -203,18 +203,7 @@ PROCESS_THREAD(poti, ev, data)
|
|||
char buf [4];
|
||||
coap_transaction_t *transaction;
|
||||
|
||||
/*
|
||||
* Note: A sending transaction may be still in progress when
|
||||
* we call the following code. This means that the *new*
|
||||
* value in the transaction buffer will overwrite the old
|
||||
* value *but* the old length remains. This means if we
|
||||
* first send 255 (and the transaction sending 255 is still
|
||||
* in progress) and we now send 0, the resulting buffer is
|
||||
* 055 (because only the 0 is copied but the old length
|
||||
* stays). Therefore as a workaround we *always* send a
|
||||
* 3-byte value.
|
||||
*/
|
||||
sprintf (buf, "%03d", val);
|
||||
sprintf (buf, "%d", val);
|
||||
lastval = val;
|
||||
printf ("Sending Value: %s\n", buf);
|
||||
coap_init_message (request, COAP_TYPE_NON, COAP_PUT, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue