summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-07-18Fix bad memory access at client disconnectionJosé Bollo4-13/+12
The management of structures handling a client connection to a exported --ws-server was accessing freed memory. Tha commit fixes that issue. Bug-AGL: SPEC-2651 Change-Id: I511218afc907308347bc422a8aead32ca00bdae6 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-18Tag broadcasted events with UUID and hopJosé Bollo10-39/+139
When API have mutual dependencies, leading to loops in dependecies, broadcasting an event never ends because of the loop (see SPEC-2625). To avoid that weird flood of events, a unic identifier (UUID) is attached to broadcasted event and a tiny memory records previously broadcasted events to avoid re-sending an already sent event. The size of the memory can be set using the macro variable EVENT_BROADCAST_MEMORY_COUNT whose default value is 8. It can be reduced to 0. An other mecanism is added to limit the count of hops that a broadcasted event can do. That count can be set using the macro variable EVENT_BROADCAST_HOP_MAX whose default value is 10. Bug-AGL: SPEC-2625 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I45877583dbf478a79d405c3650880a5579ac1f9e
2019-07-18afb-evt: Refactor processing of broadcasted eventsJosé Bollo6-83/+68
Solving the bug SPEC-2625 needs to rework the broadcasting of events. It appeared that the numerical event identifier passed for broadcast wasn't used by called function except for hooking. Suppressing it introduces a clear distinction between the push and the broadcast paths. The file afb-ws-json1 is changed to avoid casting of functions. Bug-AGL: SPEC-2625 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I7dadfb8702457d6af797ec5f542add0a83224e3f
2019-07-18uuid: Add module for UUID generationJosé Bollo4-70/+125
This commit allow modules of afb-daemon to request UUID. This introduce an abstraction above libuuid for 3 reasons: 1. Using uuid had bad side effect inthe past because it required enought entropy at start time, leading to hanging initialisations in wait for enough entropy. 2. Solving bug SPEC-2625 will require use of UUID. 3. Porting to systems that haven't libuuid is made more easy after that. Bug-AGL: SPEC-2625 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I20b58cf074ca88994de049acbeb8f827359e1b69
2019-07-12afb-xreq: Forbids (un)subscribes after replyJose Bollo4-12/+32
Allowing to subscribe to a request that was replied was possible and lead to problem revealed by issues SPEC-2542 and SPEC-2599 (these issues are more related to processing unordered incoming messages). The choice was - fix the bug and authorize (un)subscribe after reply - forbids to (un)subscribe after reply Second solution was chosen for its simplicity and its networking efficiency. Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Change-Id: I09f48b760b1fd6f70d42b80df3c8053696c45966 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-12Revert "afb-stub-ws: Allow unordered process of messages"José Bollo1-1/+1
This reverts commit 5425e054fbf87fe6d024103f46e53f2a28e074f2. The change introduced in the reverted commit is no more necessary since events are sent asynchronousely. Bug-AGL: SPEC-2215 Bug-AGL: SPEC-2219 Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: I320e13477351ff8f9b8ad12fa21234cc0823b7f4
2019-07-12afb-evt: send events in separate jobJose Bollo7-46/+239
Sending events in the context of the calling process had the consequence that the ordering of the messages had to be removed (see SPEC-2215 & SPEC-2219). This was not good by nature and lead to issues SPEC-2542 and SPEC-2599. Sending events in the context of the calling process also implies to delay the calling process. For this reasons, sending events is now done in an other jobs. For that reason, the count of allowed pending jobs is increased to 100 (was 50). Bug-AGL: SPEC-2215 Bug-AGL: SPEC-2219 Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Change-Id: I5b56d952cc187b65ad6eb9344ad74e5e8d3b7540 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-05-22Fix rpm packagingguppy_7.0.3guppy/7.0.37.0.3Frederic Marec1-1/+1
Remove useless quote Bug_AGL: SPEC-2363 Change-Id: I73903d7047c25741ce257178ef3d084900563a05 Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-05-01Merge "Fix rpm packaging following review 21188" into guppyguppy_7.0.2guppy/7.0.27.0.2Jan-Simon Moeller1-1/+1
2019-04-30Change agl-app-framework-binder.shFrederic Marec3-9/+9
Aligned the two different names from the two ways of packaging From AGL-agl-app-framework-binder.sh to agl-app-framework-binder.sh for .rpm From AGL-app-framework-binder.sh to agl-app-framework-binder.sh for .deb Bug-AGL: SPEC-2365 Change-Id: Ie324ce159a55ccae7c051c97be5116d975e0da85 Signed-off-by: Frederic Marec <frederic.marec@iot.bzh> (cherry picked from commit c80873f04c5122e579333b4cf363dd623200e822)
2019-04-30Fix rpm packaging following review 21188Frederic Marec1-1/+1
Bug-AGL: SPEC-2365 Change-Id: Iec9de4201e966ef53e3f1edf9d0a6a81ae2899fc Signed-off-by: Frederic Marec <frederic.marec@iot.bzh> (cherry picked from commit 9cf1fcea338281f76eaac000930479b18dacef01)
2019-04-16afb-migration-to-binding-v3: fix broken linksClément Bénier1-3/+3
- fix broken link to the same section Change-Id: I5e104c5527fae29ff51b6208f43ed0eb3c5f8c04 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2019-04-04afb-export: Fix heap corruptionguppy_7.0.1guppy/7.0.17.0.1José Bollo1-1/+1
The allocated size wasn't correct when 'path' was used. The effect be unseen depending on size and alignment of heap chunks. Change-Id: Id9f85a0078028319491b51bc3e11cd51e4bc3755 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-02Fix false ***buffer overflow*** detectionJosé Bollo12-29/+29
The compiling option __FORTIFY_SOURCE=2 introduced a false ***buffer overflow*** detection when the flexible array 'pattern' was initilized in globset. The compiler is only complaining when the array is in a struct that is in a struct like struct { ...; struct { ...; char name[1]; }} To avoid these false detections, it is enougth to ellipsese the dimension of the array. Seems to be the now standard way of declaring flexible arrays when it was before an extension. So now: struct { ...; struct { ...; char name[]; }} works even when __FORTIFY_SOURCE=2. Bug-AGL: SPEC-2292 Change-Id: I4b4a5df505a5357f92b9ab1657175911198ca582 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27Prevent false positive during check sourceFrederic Marec1-1/+1
At runtime CFLAG _FORTIFY_SOURCE can provide false positive during its checking. Change _FORTIFY_SOURCE level to 1 to avoid wrong comportement of the package. Change-Id: Ice4b386c253c87903e58f82a446416831cb4c6bf Signed-off-by: Frederic Marec <frederic.marec@iot.bzh> (cherry picked from commit 51b8ff088991a18d744b6b86430afc8d83c4fcd8)
2019-03-22jobs: Ensure validy of event loopFrederic Marec1-0/+3
In rare circumstances during intialization threads should wait instead of using a null event loop. This is because no one has needed event loop at this stage of initialization. Change-Id: I05b6ddbc05bec50958d0981213219b1d641401a5 Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-03-12afb-stub-ws: Allow unordered process of messagesJosé Bollo1-1/+1
Requests are already sequenced on need (noconcurrency flag of bindings). Sequencing messages until their completion has a side effect when dealing with events and synchronous calls: event -> call -> reply locked until event completion (see SPEC-2219). This change could be reverted if events are converted to jobs (see SPEC-2215). Bug-AGL: SPEC-2219 Change-Id: Ia577bc54ba38291817fd5ed3e3dda1b67b2818b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-28Fix build dep on OBSronan1-1/+7
Change-Id: Iab6b88fb2b3296d8e5f1ed82e7113939dd9cf756 Signed-off-by: ronan <ronan.lemartret@iot.bzh>
2019-02-08afb-stub-ws: Fix concurrent memory issuesguppy_7.0.0guppy/7.0.07.0.0José Bollo1-3/+4
This changes takes care to increment the the count of reference before using it. Bug-AGL: SPEC-2163 Change-Id: Ia7882427eeae933eeb5030aad025ebb1da129d6f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-07jobs: Ensure releasing event loopguppy_6.99.5guppy/6.99.56.99.5Jose Bollo3-1/+32
The internal functions blocking threads for implementing call_sync were not releasing the event loop, leading to deafness of the binder. Include a tuto-4 that reproduce the issue on a binder with the bug and that also shows interesting usages of the binder. Bug-AGL: SPEC-2161 Change-Id: I83ad4d55d721a6046e798a5e06967df4dd5a7284 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-02-06Set default version to 7.0.0: GRUMPY GUPPYJosé Bollo1-1/+1
Change-Id: I2720566368e0b446529eb358af794bfb2a179014 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06Add gitreview file for guppy branchJan-Simon Möller1-1/+1
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
2019-01-18Merge changes from topic 'spec-2089'guppy_6.99.4guppy/6.99.46.99.4Jan-Simon Moeller10-298/+264
* changes: hello3: Fix warning unused variable afb-hsrv: Avoid call to getnameinfo jobs: Remove conditionnal REMOVE_SYSTEMD_EVENT jobs: Separate internal threads from others jobs: Refactor event loop handling afb-proto-ws: Serialize incoming message
2019-01-18hello3: Fix warning unused variableJose Bollo1-1/+0
The variable 'calling' was not used anymore. Change-Id: I3a041cee57b2682374084003415d13a77a554fba Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-18afb-hsrv: Avoid call to getnameinfoJosé Bollo1-6/+12
Calling getnameinfo may block the program a long time (5s) when address is zero. Bug-AGL: SPEC-2133 Change-Id: Id52b2989c5e996363fd4b6f39049f059a6ee97a2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Remove conditionnal REMOVE_SYSTEMD_EVENTJose Bollo3-128/+0
The removal of the systemd event loop will be made in later changes. Change-Id: Ia6c52feb4969f360c31cbfc50ae991f1767f007d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Separate internal threads from othersJosé Bollo1-61/+92
Foreign threads, that are not started by jobs, are allowed to use synchronous jobs_call/job_leave (directly or indirectly). This commit ensure that those foreign thread will neither acquire the eventloop nor execute jobs. Includes a tiny cleanup of remain usage. Bug-AGL: SPEC-2089 Change-Id: I2ad7fcfe2c276e34bdc4ec0c2aa3a4207bea1854 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Refactor event loop handlingJosé Bollo3-125/+184
This improves the arbitration of the single event loop across threads. Before introduction of using 'evenfd' there was several event loop. At the current time, there is only one. At the end, there will probably remain only one. Bug-AGL: SPEC-2089 Change-Id: Iac9db7cbe15b4c9c76e6e9a8f6e641ed2a9039e0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16afb-proto-ws: Serialize incoming messageJosé Bollo3-7/+6
Enforce serialisation for a connection Bug-AGL: SPEC-2089 Change-Id: Id9f261b7cc02fda78922dc511856c34b7c5bf56d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16packaging: update dependency on libmicrohttpd versionRonan Le Martret1-1/+3
app-framework-binder dependency on libmicrohttpd version has been set at least to 0.9.62 Change-Id: If6af70611a5cd6236068781437e4bcbd28f368b7 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2019-01-05Merge "afb-api-v3: Fix potential buffer overflow"Stéphane Desneux1-4/+5
2019-01-04afb-api-v3: Fix potential buffer overflowJose Bollo1-4/+5
Change-Id: I170e127ebf96d2accfdd6d6a4ec322afeaa2782f Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-04afb-binding-v3: Fix issues in includesJosé Bollo2-5/+6
Fix 1: afb_api_v3_verbose doesn't exist Fix 2: afb_api_vverbose isn't declared Fix 3: Ensure implicit cast of "api" and "req" Using presupposed knowledge of internals of afb_api_t and afb_req_t is bad when dealing with implicit conversion in C++ and is generally not the way to go. Change-Id: I2630faa5ea0ae315ca95e4fd6ed6ae1a0beb01a5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-03packaging: Remove hard dependency to samplesJose Bollo2-16/+2
Fixing names and number of samples in packaging could be avoided. Change-Id: I57355e68be45e1a4fdd6d76bcd44dea57ca63813 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-02hello3: Add verb 'after'Jose Bollo2-2/+79
The verb 'after' launches a new thread that after a delay will call a verb (like call). The type of call can be set to 'call', 'callsync', 'subcall' or 'subcallsync'. This allows to add test for asynchronous issues in multithreaded environment. Change-Id: Ic59a27b7b7fbd3716d34fdaa35c42aa9ecb7f201 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-02bindings/samples: Cleanup and tiny commentJose Bollo5-1465/+14
The count of samples was too large and with duplications. Hopefuly, removing duplications and adding a tiny README file lowers fuzzy. Change-Id: I55ed8f40a4f1e6e28e2a36f2819e25505246ecdd Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-12-31jobs: Fix a lock of call syncJose Bollo1-24/+59
Sometime the function jobs_leave missed to wake up the process that expected the result. It happened when that waiting thread was locked in the epoll. That commit unlock it. Bug-AGL: SPEC-2089 Change-Id: I6ab6a60a8c9ea3639143f282f90c7b77ed16853a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-12-19Remove useless %lang% prefix in yaml book fileguppy_6.99.3guppy/6.99.36.99.3Sebastien Douheret1-20/+20
Change-Id: I25c5efebc281f774324851372d2d074e31988847 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-12-14wrap-json: Upgrade to latest versionJosé Bollo1-18/+19
Change-Id: I3eb4e922cb5106bcf8a1ccc5e1b010bd0a60bf34 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-13afb-hsrv: Prepare selection of listening interfacesJose Bollo4-14/+139
The listening socket will no more be the default one but will be the selected ones, with ability to select more than just one listening interface. Nevertheless, the behavior is not changed at the moment. The default interface (0.0.0.0) is still used. A further change will add the ability to select the listening interfaces. That evolution depends on a fix of libmicrohttpd to enable at the same time epoll and no-listen-fd. Bug-AGL: SPEC-1833 Bug-AGL: SPEC-1016 Change-Id: Ia78671cbee90a243ba7b2c724b6155cffbde6920 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-13afb-trace: Make real timestampsJosé Bollo1-10/+0
The optimisation that represent the timestamp as a fake double is not accurate in local context. Bug-AGL: SPEC-2051 Change-Id: I285837251507a69ad210823020d0cf69ad5999f3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-13docs: add yaml bookClément Bénier1-0/+55
SPEC-1988 Change-Id: Ida94e5cf39b8c23efca9620d62ec2db55746d2b3 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-12-05afb-proto-ws: Add error reportJose Bollo3-1/+15
Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-12-05afb-hook: Improve reentrancy of hookingJosé Bollo1-126/+163
Work on testing showed that a deadlock was occuring in management of hooks. Change-Id: Ib51eb4f0b9ffc5d9dfe2770f2c3f8f47f262b60f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-28Fix deprecation warnings for older GCC versionsguppy_6.99.2guppy/6.99.26.99.2Johann CAHIER1-2/+2
For some reason, SDK doesn't display warning when AFB_BINDING_VERSION is defined as 2. Using #warning instead of #pragma GCC warning fixes the display. Change-Id: I3c96b3630e0d1eac63b2fde72bdec3c7f3d1714a Signed-off-by: Johann CAHIER <johann.cahier@iot.bzh>
2018-11-22globset: Introduce globset for event handlingguppy_6.99.1guppy/6.99.16.99.1Jose Bollo9-87/+693
It optimises the event handling that was slow. It also fix few bugs: - at most one event handler is called now - the handler call has the most specific pattern Change-Id: Ic13a0258b5743579ab15e0e953ec62206d982850 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-11-20AFB.js: Tiny improvement and space fixJosé Bollo1-4/+4
Change-Id: I170abe0dd1a1de3d2cc2ea7f86c746eb93e63eae Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-16afb-socket: Fix address reuseJosé Bollo1-7/+7
Change-Id: I3ae51611b92762a4f09b1f6cca6ff27853cd9f95 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-16afb-export: Fix error in event handlingJosé Bollo1-1/+1
Change-Id: I2869a2a840fb07550d493ddc2d651358892d33d1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-08main-afb-daemon: Export variables to connect to binderJosé Bollo1-12/+42
Two new variables are exported that will allow to connect to the binder: - AFB_PORT: the HTTP port that the binder listen - AFB_TOKEN: the initial token that the binder expects These variables are defined only if the HTTP server is started. They are available during initialisation of bindings, even if it is before the real start of the HTTP server. Change-Id: I1b7c8572e3d77b7036a32af47b2a2f1d95803a41 Signed-off-by: José Bollo <jose.bollo@iot.bzh>