Commit graph

728 commits

Author SHA1 Message Date
Peter 432f12e156 Several changes to fix bugs and harden mqtt code.
1. The PT_MQTT_WAIT_SEND() macro has several issues:

- It does not check the return value from process_post(), which
  sometimes returns an error code. See next issue.

- Each time the macro is called, is posts an event to itself. The idea
seems to be that the event should be absorbed by the macro itself, so
when the macro terminates there is NOT a net growth of the event
queue. This does not work.  The reason is that the
PROCESS_WAIT_EVENT() sometimes absorbs a broadcast event instead of
its own event, and then the number of events in the event queue
increases. This leads to event explosions and overflow in the event
queue.

- The macro cannot call PT_EXIT(). This will expand to a return
statement, causing a return from the function calling the macro
(mqtt_process), rather then exiting the protothread (which was
probably the intention). Protothreads have lexical scope...

Fixes: 1) Check return value from process_post() 2) Loop until the
event posted to itself is absorbed (rather than just absorbing the
next event) 3) Replace PT_EXIT() with PT_INIT() (doesn't really make a
difference, could probably just be removed).

2. Change order of the checks in the protothread-calling loops in
mqtt_process().  Reason: When a protothread has been cleared by
PT_MQTT_WAIT_SEND(), it will not return a value, so checking against
PT_EXITED does not make sense.

3. PT_MQTT_WRITE_BYTES() should initialize conn->out_write_pos to 0.
When PT_MQTT_WRITE_BYTES() does not finish (due to TCP disconnect for
instance), it may leave conn->out_write_pos with a non-zero
value. Next time PT_MQTT_WRITE_BYTES() is called, it will take data
from the wrong place.

4. Put MQTT_CONN_STATE_ABORT_IMMEDIATE before
MQTT_CONN_STATE_NOT_CONNECTED in the enum list, so that the check
if(conn->state > MQTT_CONN_STATE_NOT_CONNECTED) in mqtt_connect()
fails when in state MQTT_CONN_STATE_ABORT_IMMEDIATE. Otherwise, it
will deadlock and not reattempt connections while in this state.
2017-03-21 16:43:15 +01:00
George Oikonomou 739b901e0d Add missing variable declaration
#1972 removed the declaration of `i` from various locations. In one of those locations it is still needed. This commit puts it back
2017-03-18 14:01:10 +00:00
George Oikonomou 758d9aa168 Merge pull request #1972 from MohamedSeliem/patch-11
update httpd_cgi to enable the compilation of webserver-ipv6 example
2017-03-18 13:50:52 +00:00
Thomas Blank ed1b27e40b Fix Bug in MQTT App: Refused Connections should not be pursued.
No means no.
2017-03-09 19:35:20 +01:00
Yasuyuki Tanaka 83f2382791 Orchestra: avoid a link error for nbr_routes 2017-01-19 13:55:08 +01:00
Mohamed Seliem 88fdc46e03 update httpd_cgi to enable the compilation of webserver-ipv6 example
this simple change fixes the bug reported in @#1541.
../../apps/webserver/httpd.h:63:9: note: expected ‘uip_ip6addr_t’ but argument is of type ‘union uip_ipaddr_t *’
2016-12-04 19:03:15 +02:00
Antonio Lignan efde9132a8 Merge pull request #1769 from gebart/pr/rest-engine-periodic-add-poll
rest-engine: Allow adding periodic resources after starting REST engine
2016-11-11 09:01:32 +01:00
aho 8306aded79 fixed typo in debug PRINTF definition 2016-10-25 12:38:15 +03:00
Oliver Schmidt 957ac63a7c Improved dicarding of text in the HTML header.
Plain text in the HTML header (think of <title>text</title>) is collected as usual. The decision to discard it is triggered by the first withspace following. In the usual case of the <body> no preceeded by any whitespace this means that by the point the first whitespace is encountered we're not in "discard mode" anymore and therefore incorrectly render the text.

Explicitly calling do_word() just before leaving "discard mode" discards all text collected so far.
2016-10-11 11:25:31 +02:00
Nicolas Tsiftes fa6771f058 Merge pull request #1677 from gebart/pr/lwm2m-instance-list
oma-lwm2m: Add functionality to send object instance list as core link format
2016-09-06 16:50:11 +02:00
Joakim Nohlgård f16f5b5241 squash clean up left overs 2016-07-09 10:39:23 +02:00
Joakim Nohlgård 6b238873ef squash move rest-engine timers to activate timer 2016-07-09 10:34:23 +02:00
Joakim Nohlgård e7070a5f79 rest-engine: Allow adding periodic resources after starting REST engine
Without this fix, any periodic resources added after the REST engine was
already running were never started.
2016-07-06 19:18:34 +02:00
Tiago Koji Castro Shibata c2a0f739f7 Compilation targeting c64
Adds some casts required by cc65 compiler and small fixes
2016-06-12 21:16:01 -03:00
Simon Duquennoy c3ea1f9fc6 Orchestra: added support for RPL non-storing mode 2016-06-08 14:03:24 +02:00
Simon Duquennoy 6c946319d9 Merge pull request #1667 from alignan/pull/at-driver
AT driver (master) and example
2016-06-04 22:47:24 +02:00
Joakim Nohlgård e8edb6b1a0 oma-lwm2m: Add JSON writer 2016-05-28 07:55:54 +02:00
Joakim Nohlgård 9832b356ba oma-lwm2m: Use Accept header to determine the writer object for the content 2016-05-28 07:55:27 +02:00
Joakim Nohlgård 14cdb30886 oma-lwm2m: Only send active instances 2016-05-24 20:00:56 +02:00
Joakim Nohlgård 84cd7a4e92 oma-lwm2m: Add functionality to send object instance list as core link format 2016-05-24 20:00:56 +02:00
Nicolas Tsiftes 562a33aa16 Merge pull request #1670 from gebart/pr/lwm2m-decimal-point
oma-lwm2m: Handle text/plain floatfix numbers without decimal point
2016-05-23 15:22:35 +02:00
Yasuyuki Tanaka bc54f8bac3 Orchestra: add NULL checks into new_time_source (eb-per-time-source) 2016-05-21 13:43:42 +02:00
Joakim Nohlgård 99c77bda8c oma-lwm2m: Handle text/plain floatfix numbers without decimal point
Fixes bug: If no decimal point is present then the entire number is
treated as the decimal part instead of the integer part
2016-05-21 09:48:06 +02:00
Simon Duquennoy c7694e4dbd Orchestra: fix orchestra-rule-eb-per-time-source to handle hash collisions 2016-05-20 13:51:24 +02:00
Simon Duquennoy 7e8d042609 Orchestra: fix bug in new_time_source 2016-05-20 13:40:50 +02:00
Simon Duquennoy 287b4767e3 Orchestra: handle case where ORCHESTRA_UNICAST_PERIOD is smaller than the network size 2016-05-20 13:40:20 +02:00
Antonio Lignan 2b30370b42 AT driver (master) and example 2016-05-15 12:19:04 +02:00
Nicolas Tsiftes 98fcac15cd Merge pull request #1651 from gebart/pr/lwm2m-json-sv-bv
oma-lwm2m: Use sv for string value, bv for boolean
2016-05-12 17:01:16 +02:00
Joakim Nohlgård 22e9ccadf7 ipso-temperature: Use "Cel" for degrees celsius
Like the IPSO documentation says
2016-05-04 19:21:56 +02:00
Joakim Nohlgård cb729b0785 oma-lwm2m: Use sv for string value, bv for boolean
Like the OMA docs specify
2016-05-04 19:15:01 +02:00
Nicolas Tsiftes fb5f0f66dd Removed Deluge and associated test files. 2016-04-21 13:24:16 +02:00
Simon Duquennoy a15be9e518 Merge pull request #1438 from jkent/jsonparse
jsonparse: multiple improvements
2016-03-11 14:23:17 +01:00
Joakim Nohlgård 4ff571beb2 apps/er-coap/er-coap-separate.h: fix warning: function declaration isn't a prototype 2016-03-02 07:12:33 +01:00
Joakim Nohlgård 9159903f5a apps/er-coap/er-coap-transactions.h: fix warning: function declaration isn't a prototype 2016-03-02 07:12:31 +01:00
Antonio Lignan 4d4930921e Fixes error when processes name are not used 2016-02-22 16:02:06 +01:00
Simon Duquennoy b53a1569d9 Merge pull request #1439 from jkent/jsontree
jsontree: new features
2016-02-20 12:49:07 +01:00
Simon Duquennoy fa078381cf Fix compiler warnings in shell 2016-02-03 18:01:25 +01:00
zq301 d36eab3750 Update shell-vars.c 2016-01-25 09:35:49 +08:00
zq301 e7c26c57db Update shell-vars.c 2016-01-25 09:35:15 +08:00
zq301 915facad22 a memory overflow in shell-vars.c
" sprintf(numbuf, "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x",...)" . the formatted data wrote to "numbuf" is 39 bytes, but numbuf is 32 bytes.
2016-01-24 14:39:48 +08:00
Simon Duquennoy c792f5cf4b Merge pull request #1409 from nfi/oma-lwm2m-ipso
Implementation of OMA LWM2M Engine / IPSO Objects
2016-01-17 10:20:33 +01:00
Jeff Kent 7dc1581631 jsonparse: multiple improvements
* input string now can be any json value type
* syntax handling completed
* stack is now used more efficiently for objects
* implemented atomic values true, false, and null
* jsonparse_copy_value now handles escapes
2015-12-28 09:47:12 -06:00
Jeff Kent a65d566dee jsontree: add int pointer types 2015-12-28 09:45:29 -06:00
Jeff Kent bcc7d0a1eb jsontree: add uint type 2015-12-28 09:45:23 -06:00
Jeff Kent fcc87ddce8 jsontree: add JSONTREE_CONF_PRETTY option 2015-12-28 09:45:09 -06:00
Joakim Eriksson a90ff6691a fixed leds control to work with red,green and blue LED - tested with remote. 2015-12-21 13:02:34 +01:00
Atis Elsts d79ce957a1 Adaptive time synchronization for TSCH 2015-12-07 11:51:41 +01:00
Simon Duquennoy 7eabf8d391 TSCH: latest update from https://github.com/EIT-ICT-RICH/contiki 2015-12-04 15:21:58 +01:00
Simon Duquennoy 27da5b8ab5 Orchestra: typo 2015-12-04 15:21:57 +01:00
Simon Duquennoy bc1e27cab7 Added Orchestra, an autonomous scheduler for TSCH exploiting the local RPL state to maintain slotframes and links 2015-12-04 15:21:54 +01:00