aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-02-27Added a tutorial and fix few errorssandbox/ctxnop/binding-objectLoïc Collignon4-25/+118
Added the tuto-5 that show how to benefit from the new 'binding-object' header. Fix few errors that can cause segfault when dealing with events and use the right afb::req object for verbs. Change-Id: I0563dd72a2843b2b54c2e40398ba129aac05ff0c Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-02-27Avoid relative path when including headersLoïc Collignon1-1/+0
Prefer the system path to include headers. Change-Id: Id20d7c07b628bb8da25abeef3bc10456693a93f9 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-02-27stress: Improve the stress test scriptsJosé Bollo2-69/+109
The improvement was able to track the bug SPEC-2163 by launching: - ./stress-server.sh --ws --valgrind - ./stress-clients.sh --null --count 20 Bug-AGL: SPEC-2163 Change-Id: I04634f0e98ab7a28df7c1d34ecc0d9c1faf43d57 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-27afb-stub-ws: Fix concurrent memory issuesJosé 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-27Update copyright dateJosé Bollo188-190/+190
Change-Id: I3aaa92b2bfb01699ee8ae609272e93032b6f1a9d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-27Set next version of binderJosé Bollo1-1/+1
Change-Id: I53c43380902f96b7a46a6a131a956965d7cf6fbc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-27jobs: Ensure releasing event loopJose 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-27Merge changes from topic 'spec-2089'Jan-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 Change-Id: I52455af14cb7d6fb69bc2b5eecacf688348cba58
2019-02-27packaging: 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-02-27hello3: 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-02-27afb-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-02-27jobs: 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-02-27jobs: 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-02-27jobs: 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-02-27afb-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-21Make the object inherits the 'raw' classLoïc Collignon1-3/+2
Base the 'object' api on the newly added api wrapper. Change-Id: I8370552688bed19265427213fc1cc2f5660aada3 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04Added an 'api' wrapperLoïc Collignon1-1/+154
New 'api' wrapper for 'api' related functions. Change-Id: If6fd7adad1d3172defffe020203b637ace17aa6e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04Reworked the event classLoïc Collignon1-8/+11
Added move semantic and remove invalidation method as it's not used anymore since we drop the support of APIv2. Change-Id: I291155cef3e55ca14c706aa2315ab8dbfd09dffb Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04Fix multiple definition and castLoïc Collignon1-6/+3
The function was defined as many time as the header was included. Making it a weak function fix the issue. Also, a plain old C cast is required to make this constexpr valid. Change-Id: Iee5677873180accfddcad0b3a58f3776f9fd8c5e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04binding-wrap: Add verb initialisation for C++Jose Bollo2-6/+37
This new constexpr initialisation method accepts a callback receiving a afb::req instead of a afb_req_t. Change-Id: I742e3dcf1e81873e76f61c319198e3cf7ef5ec0f Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-04Fix a template that use the wrong callback definitionLoïc Collignon1-1/+1
It used the legacy callback definition instead of the good one. Change-Id: I5ad6e881e9fb99f1076a6dfa9ded221ccfec4a03 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04Drop APIv2 support on the C++ interfaceLoïc Collignon1-87/+3
The C++ interface is currently used only in APIv3. Change-Id: Idc53bc80a939292f9882fdc62849dd27e543cbf8 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04Avoid relative path when including headersLoïc Collignon4-7/+9
Prefer the system path to include headers. Change-Id: Id20d7c07b628bb8da25abeef3bc10456693a93f9 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-01-04Added a new C++ APILoïc Collignon2-2/+1
You can create an API by inheriting a base class and overring the methods you want. Change-Id: I62fa5ee8f347cd4d7baa7df39c0fcd6c83c4c34e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
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-04packaging: 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-04hello3: 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-04bindings/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>
2019-01-02Added a new C++ APILoïc Collignon4-1/+345
You can create an API by inheriting a base class and overring the methods you want. Change-Id: I62fa5ee8f347cd4d7baa7df39c0fcd6c83c4c34e Signed-off-by: Loïc Collignon <loic.collignon@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>
2018-11-02Merge "afb-socket: Relax requirement of tcp ending slash"Jan-Simon Moeller1-1/+1
2018-11-02Merge "afb-socket: Handle listening on all interfaces"Jan-Simon Moeller1-0/+5
2018-10-30afb-socket: Relax requirement of tcp ending slashJosé Bollo1-1/+1
The uri for tcp was requiring a slash (/) after the port. This change allows to not provide that slash. This is usefull for future implementation of HTTP server selection. Change-Id: I0a76d167065258d242845579b7c8728eefcc359f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-10-30samples: Fix compiling errorJose Bollo1-1/+1
Latest versions of libraries used doesn't define TRUE. This fix it by using 1 instead. Change-Id: I17db5ca34aeceab96c83143f49094fbaca74a95a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-10-30afb-socket: Handle listening on all interfacesJose Bollo1-0/+5
Change-Id: I909493166f98f152e5aeb02a72f40bc3c58b42b2 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-10-26afb-hsrv: Adapt to next version of libmicrohttpdJosé Bollo1-1/+4
Change-Id: I5bef17178e972e73b653ddbff5a8b09cfc2287eb Signed-off-by: José Bollo <jose.bollo@iot.bzh>