José Bollo [Tue, 25 Apr 2017 15:21:28 +0000 (17:21 +0200)]
Add 'afb_daemon_queue_job' for bindings
This allow bindings to queue asynchronous jobs.
Change-Id: I2a228388c9defde23adb672d579c4a299f212850
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 14:46:43 +0000 (16:46 +0200)]
typo
Change-Id: Ie270c9716477054d0d16fd3b8d8bbfee1f8de084
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 14:06:31 +0000 (16:06 +0200)]
Make monitor use the interface version 2
Enforce monitor API to be a kind of standard binding.
Change-Id: I4739f879d5e076eb3505f5fe2cf658e6f9299de6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 14:04:12 +0000 (16:04 +0200)]
Update the monitor interface for private feature
Change-Id: I14caa33d2abad26bf244e93f7efe93206c6c50da
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 14:03:11 +0000 (16:03 +0200)]
Add private binding interface feature
Also make correct strings
Change-Id: Iac63fb8202c115458910ca1ec42fbca9872df9f8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 12:30:24 +0000 (14:30 +0200)]
genskel: add tiny skeleton generator
This adds a tiny generator of skeleton for bindings
version 2. This is a research work.
Change-Id: Id72f6addfd18ebb866e3b609bb49e74ee676b83d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 12:29:42 +0000 (14:29 +0200)]
cleanup
Change-Id: Ia49afc6c7d70da676ac9ea6b493a23fc3756a482
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 25 Apr 2017 12:29:17 +0000 (14:29 +0200)]
typo
Change-Id: Ia6c5deab1ed154ae7ad690236b8739ddff6e3935
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 17:04:54 +0000 (19:04 +0200)]
afb-monitor: draft of monitoring
this is a draft version to be continued.
Change-Id: I1062a6f872a2b36d4e0434fb18d1857961d50aab
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 17:02:41 +0000 (19:02 +0200)]
afb-api: add a 'describe' function
this is intended for introspection
Change-Id: I2518893c8cb04295159c3646f1286ffd30f739e0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 17:01:31 +0000 (19:01 +0200)]
afb-api-so-v2: split the declaration in two parts
Having a part not linked to an existing opened shared library
might be useful for internal APIS.
Change-Id: I56348f07c87f6844682e3ea56dc07d7ee296bfbf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 17:00:02 +0000 (19:00 +0200)]
main: init session module first
Change-Id: If2acee2fa6469cbfb6c2d11eb1e3fd622b093155
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 16:59:02 +0000 (18:59 +0200)]
apiset: improvements
Change-Id: I476ab17bb5c48dbb3cd6c215687989203407549f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 09:24:46 +0000 (11:24 +0200)]
stress-server: fix rootdir
Change-Id: Ic19ffd24be4bba54274150e1b71324e9017b402f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 09:23:52 +0000 (11:23 +0200)]
afb-client-demo: Handle comments
Change-Id: I39287c5b5bba8b3ec18dc36e58a0d0102c5b48d6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 21 Apr 2017 09:19:50 +0000 (11:19 +0200)]
fix bug on incoming event
Change-Id: I7678412374565fd5802b0312e5808e2645df3728
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 20 Apr 2017 10:52:23 +0000 (12:52 +0200)]
cleanup and improvement of xreq
Change-Id: Iefda7f9d8f979a50fb2586a27edf0ca16d056a1f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 20 Apr 2017 08:02:49 +0000 (10:02 +0200)]
Add default api to apiset
Also improve interface of apiset.
Change-Id: I3c256ce1ecb089f0b518e45f0dee139c04943f2e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 20 Apr 2017 07:35:23 +0000 (09:35 +0200)]
Use of 'afb_api_is_valid_name'
Use the common function 'afb_api_is_valid_name'
instead of 'afb_apiset_valid_name'.
Change-Id: I2d761473d4aa1cd90adf1b7a2c1976e727b437fc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 19 Apr 2017 13:15:29 +0000 (15:15 +0200)]
simplify main file
Change-Id: I590bf289ce597531622dc95bb00df11e0a8bdbb6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 14 Apr 2017 17:47:57 +0000 (19:47 +0200)]
Create afb-stub-ws by spliting afb-api-ws
The file afb-stub-ws only carries the protocol
of the internal remote calling conventions.
It as the following benefits:
- it easies transition to symetric connection (not planned)
- it allows to have server stub on client socket and
conversely, client stub on server socket (planned for
debugging).
Change-Id: I57dc8e78d7bd63427421a180abcb844f8313d37b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 14 Apr 2017 13:36:53 +0000 (15:36 +0200)]
allow abstract unix sockets
unix sockets named "unix:@something" are now treated
as abstract sockets.
Change-Id: Ieb2bb9dd1c7b420b9e3fae81590ef49c32f63802
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 14 Apr 2017 13:35:43 +0000 (15:35 +0200)]
use heuristic message ids
Change-Id: I9492288de61b79074db38818c459f7447b12b4e6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 14 Apr 2017 12:19:32 +0000 (14:19 +0200)]
improve stress test outputs
Change-Id: I86b62cfa2b6da6963d1014ae4362ea5f7338c736
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 20:58:33 +0000 (22:58 +0200)]
Introduce apiset for grouping apis
This will be used at the end for debugging
facilities.
Change-Id: I75e3345667e1f58143c77a885e166375680ca194
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 14:05:30 +0000 (16:05 +0200)]
Implement subcall for services over websockets
This modification make subcalls pushed back to
the client that will issue it for itself. This
will at the end ensure the security context of
the client.
Change-Id: Ib4bb5125ffe1b942103b72d1a3d13892dda87baa
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 12:50:36 +0000 (14:50 +0200)]
secure subcall api and verb
Change-Id: Ia1df54bfd139f247137f4373a2cbd75dcf74efc8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 12:49:51 +0000 (14:49 +0200)]
enforce reset of xreq at init
Change-Id: I37ff13a34c780ab00fb43e0a4daeda45db821c00
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 08:50:15 +0000 (10:50 +0200)]
Enhance client->server protocol
This commit adds a protocol header for inter binder
communication in the direction client->server.
It also changes how data buffer is handled.
Change-Id: I1eb4253408ddd4c8042773da541d27046e90f715
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 08:25:16 +0000 (10:25 +0200)]
Simplification of sig-monitor
Remove unused functions
Change-Id: Ie767469a3e721aba5d9d27ab318a1d316553b2cb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 07:54:04 +0000 (09:54 +0200)]
Use names for constants
quality improvement
Change-Id: I1d8fda1ec48bb9d3c6eb2ee88b579cfcf8dcc5fb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 13 Apr 2017 07:43:18 +0000 (09:43 +0200)]
Simplification and optimisation of jobs
It comes from the use of this module that it can
be simplified to only get 1 argument. It reduces
either the complexity of the code and the time spent
in job management.
It optimise how normal jobs are called (not intermediate
function).
Also factorisation and simplification of synchronous
enter/call.
Change-Id: Id60dd2363fee2b007b4557430659faf733d2179d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 15:58:38 +0000 (17:58 +0200)]
reduce verbosity
Change-Id: I625dd517912461bb55f298a11a5eb37adc92293b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 15:56:20 +0000 (17:56 +0200)]
Add credential data to xreq
This will allow soon to check the credentials when
evaluating calls.
Change-Id: I993216ccbc02538dcd92e49fcb2de0541eeb8c01
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 15:56:10 +0000 (17:56 +0200)]
add argument to stress-server.sh
Change-Id: I75fccf6c9b5c37c7548019e510f7c3281a5cd664
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 15:12:44 +0000 (17:12 +0200)]
fix typo
Change-Id: I83473a69d8af4d39d1ef7eba9c324a6bbb0364fc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 15:00:33 +0000 (17:00 +0200)]
Optimisation of xreq
Reduce the count of memory read
Change-Id: Ie4dfa4bd30d6485be91961196294c43ffbd3b2a9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 12:11:16 +0000 (14:11 +0200)]
Add computation of credentials
Credentials are computed if possible.
Change-Id: I36c7e95a35431b27109c26b51eab690d685862e1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 12 Apr 2017 12:09:12 +0000 (14:09 +0200)]
Rename destination as origin
Change-Id: I9c76ab3043506778640cb379e8f006674f8a8fcf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 11 Apr 2017 16:37:52 +0000 (18:37 +0200)]
Fix uninitialized variable
Change-Id: Ia8a7a1471f004933a48797b91c01fd8b53465de0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 11 Apr 2017 13:40:44 +0000 (15:40 +0200)]
Refactor stress test
Stress test now has 2 parts: the server part and
the client part.
Change-Id: I24e46060a1a710381476157f4fb4e8ad32370a5e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 11 Apr 2017 12:15:55 +0000 (14:15 +0200)]
Fix a crash on disconnection
Change-Id: Ib3654ac8125b040f8264524e7c821a6559f627cd
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 11 Apr 2017 12:15:38 +0000 (14:15 +0200)]
Fix a memory leak
Change-Id: Id47b417f6e5f8bf2322b1de7ed12579de711160f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 11 Apr 2017 11:16:36 +0000 (13:16 +0200)]
fix typo
Change-Id: I7a445c73a9bb6b39c3ba5e19422f5bcc319364fe
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 11 Apr 2017 09:47:27 +0000 (11:47 +0200)]
Add startup call in command line
The option -c (aka --call) allows to specify calls
to api/verb at startup. The calls are made sequentially.
Change-Id: I7f087dce71480fe288cca355c209a4c8ccf4f4b9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 19:39:22 +0000 (21:39 +0200)]
Make implementation multithread
This changes makes many improvement needed
for multi-threading:
- json object can't be shared across threads
because get/set is not protected
- event are now multithread compatible
Change-Id: Id44b12c68e0fa67042b8ea44939af4edfa76270a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 19:36:26 +0000 (21:36 +0200)]
Enforce flush of incoming data
Change-Id: I81deb974460e7f3edbccf132efeac87f873d78dd
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 19:35:57 +0000 (21:35 +0200)]
Make HelloWord binding multi-thread
Handling of event was not compatible with
multi threaded. This implmentation solves
this by protecting event access with mutexes.
Change-Id: Ie52216289000f1ae6352c9dda442dfbda1ebe850
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 13:19:04 +0000 (15:19 +0200)]
Refactor of initialisation
Change-Id: Ie5209f74ea1a65571a3ec54724131f15d22ca35f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 13:15:21 +0000 (15:15 +0200)]
Refactor setting of directories
When not specified, the default directories are
now ".". The workdir is relative to the current directory
and other directories are relative the the workdir.
Change-Id: I52c013e3a3c93b3f984903562cf0c56d990900e6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 11:11:04 +0000 (13:11 +0200)]
Fix typo
Change-Id: I0077f77984accdd1f07d0e7c1526720f687ec58e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 11:10:48 +0000 (13:10 +0200)]
Isolate interupt management
Provision daemon features:
- SIGTERM for terminating
- SIGHUP for config reload
Change-Id: Id45a0b963812105c22ead5a0a2004f3f531a2a65
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 10:00:14 +0000 (12:00 +0200)]
Websocket client select if looping or not
Allows the client to tell websocket module to not
loop on messages.
Change-Id: Iaa1025ce5442a5659554ba66fcc5869a1e8659b4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 10 Apr 2017 09:41:21 +0000 (11:41 +0200)]
Refactor of API interfaces
The new interface has increased functionnality,
it allows to set debug flags by API.
Change-Id: Ibd35fb02ed645e22cac8e7021b37b96e07e79877
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 7 Apr 2017 15:05:24 +0000 (17:05 +0200)]
Add hooking of daemon interface
Change-Id: I5840609f4300ade98412e8527ac5ce1f1e8c0c59
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 7 Apr 2017 10:52:58 +0000 (12:52 +0200)]
Improve log messages
Add ability to discuss directly with systemd journal.
Add report of functions name when logging.
Change-Id: Ia7c5836e387b621b47e3700a7abca40bc0e481c8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 7 Apr 2017 08:57:55 +0000 (10:57 +0200)]
Finalize hooking of requests
Change-Id: I0c03b2c8ce556f1e6987ee5a7ad355ba9e67f142
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 17:18:08 +0000 (19:18 +0200)]
Reactivate hooking of requests
Change-Id: I0fc8429063d99e10344aaadba06480a470b9eb9d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 12:52:04 +0000 (14:52 +0200)]
Avoid prompting error on empty line
Change-Id: I9da7f17f93f1948da23f6a2304f0718d7bee6464
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 12:51:08 +0000 (14:51 +0200)]
Improve names
Change-Id: Ib7e31b50a725c73e6eaba414c6628524fbcd84f9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 14:24:46 +0000 (16:24 +0200)]
Make websocket concurrent
Stress tests shown that the module wsj1
wasn't ready to concurrency.
Change-Id: Ia54196f97e9712adf0920b59b188d570f39a6b4f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 12:47:53 +0000 (14:47 +0200)]
Add a script for stressing the daemon
Change-Id: Ic8c5241339106376daaf91acafca1e4fb0f5f818
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 08:31:09 +0000 (10:31 +0200)]
Add an easy function for synchronous calls
The added function, 'jobs_call', allows to call
a job with 'group' sequencing and 'timeout'
handling synchronously.
The difference with 'jobs_enter' is that the
function 'jobs_call' assert that the job is
terminated when 'callback' returns.
Change-Id: I8c01d1cd017787ca0448b03a899305a9069ebb6c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 08:20:45 +0000 (10:20 +0200)]
Avoid to stick on event loop
When working synchronously, waiting continuously
to an event can make deadlocks. This commit
enforce threads that wait for some job completion
to wait for a fixed amount of time.
An alternative management with signals should
be studied in future.
Change-Id: Idcfadc60f8c14d73d7fa32e937c6ea0f552cc09b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 6 Apr 2017 07:20:56 +0000 (09:20 +0200)]
Reduce explicitely recursion
When evaluating permissions, the recursive
algorithm is replaced with an algorithm
that eliminates the tail recursion.
Change-Id: I3298c42fa658498a954f4bf7dedfad87f00ab736
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 5 Apr 2017 16:08:27 +0000 (18:08 +0200)]
Make daemon interface common
For the future, having only one piece of code
to handle daemon interface to bindings is an
improvement.
Change-Id: I806c424eb1a82637d27bc84b921612789907d971
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 5 Apr 2017 12:47:12 +0000 (14:47 +0200)]
Add permission subsystem
Change-Id: I0bbbf55832faf6413dd6147174934d0d4dc5277d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 15:30:55 +0000 (17:30 +0200)]
Ensure that subcall_sync use subcall
The intent is to provide the asynchronous subcall
as standard. This is needed for fixing subcall
across connections (DBus or WebSocket).
Change-Id: Ia046cfa4d0124bfa3ba7eb8e8f936eeafcf09875
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 13:04:21 +0000 (15:04 +0200)]
Avoid to count child threads
The count of allowed threads must be the real
count of threads started.
Change-Id: Iaefc9fa4368042d6db45ed3333f9591da027b2f0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 12:54:22 +0000 (14:54 +0200)]
Improve debugging options
Change-Id: I3550a4c2500b98efa985e678217e3d91bc8ca4c6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 12:52:40 +0000 (14:52 +0200)]
Add synchronous subcalls
Synchronous subcalls are more easy for
writing simple applications with sequential
logic.
Change-Id: I76a0231a64a6db8270014cd2a64284e1b0fc16ec
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 09:50:17 +0000 (11:50 +0200)]
Use SIGHUP instead of SIGKILL
This doesn't enforces anymore the brutal
termination.
Change-Id: I62445c7cb3692354637906fb1ddda1787c8fb82a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 09:49:15 +0000 (11:49 +0200)]
Launch job at a earlier step
Change-Id: I3fcb96e4d748e38eacc4d413a451143dd9b4a10d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 08:10:13 +0000 (10:10 +0200)]
Definitive switch to internal's xreq
This switch allows to work on a common base for
the requests.
Change-Id: I94e7fdda80c1966af399309334c41c7c8c8259dc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 07:51:28 +0000 (09:51 +0200)]
Migrates subcalls to use xreq
Change-Id: If865208bc0c207511d2b11e4cff617005ed01e56
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 4 Apr 2017 07:50:53 +0000 (09:50 +0200)]
Introduce subcontext for subcalls
Change-Id: I5460e9c502cee814c59a0ee60c2be001385e7b4a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 3 Apr 2017 15:35:32 +0000 (17:35 +0200)]
Switch API D-Bus to xreq
Change-Id: I16bfa2594f8de4babcc0d3cc1a62e7d0856d2479
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 3 Apr 2017 15:35:03 +0000 (17:35 +0200)]
Switch API websocket to xreq
Change-Id: I57600d8dc99bf37f207b126a0e3ab5731ad08ced
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 3 Apr 2017 15:34:21 +0000 (17:34 +0200)]
Improve interface xreq
Add missing function for further work
Change-Id: I4e2b7a35b45ffb0edb1fd14b52500c9b00fab807
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 3 Apr 2017 15:33:35 +0000 (17:33 +0200)]
Add notification message for added API
Change-Id: I797afeaa0758f2fef854a1ffaee398aff6c9041e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 3 Apr 2017 15:22:39 +0000 (17:22 +0200)]
Rework the jobs
Enforce starting jobs with acquiring the
calling thread.
Removes invoke methods in favour of
enter/leave synchronisation.
Change-Id: I7086f7f53b919b43ddafd2355316abc0d3516f49
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 31 Mar 2017 15:50:19 +0000 (17:50 +0200)]
Use xreq for services
Change-Id: I05d0ddb36635c01b3d56ae52a08fbb68f3b3a6a9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 31 Mar 2017 14:58:14 +0000 (16:58 +0200)]
Use xreq for websockets
Change-Id: Ia489f863e8be3384fbe8a240f6010f7d5916b72a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 31 Mar 2017 14:11:07 +0000 (16:11 +0200)]
Factorize common code for handling requests
The common code for session handling is
shared using struct afb_xreq. At the moment
only hreq leverages the new feature.
The objective is double: make the work of
writing new internal requests more easy and
prepare to check permissions.
Change-Id: If3ca311d68c2d8c427d1125f31a2704b150c2c94
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Fri, 31 Mar 2017 09:55:20 +0000 (11:55 +0200)]
Allow detection of session closure
In some case it can be good to have a function called
when the session closes. This is the case when a binding
records an item in the context. With this modification
the recorded item can be simply NULL.
Change-Id: I5e23f00eb2a6e2639fdeea15f9dea79c7df9dfbb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 30 Mar 2017 17:02:06 +0000 (19:02 +0200)]
Start to implement the bindings V2
More work has to be done for merging common
code.
Change-Id: I72b01901f978854843967c12bfcb3cc59cc10310
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 30 Mar 2017 12:22:03 +0000 (14:22 +0200)]
Overall integration of job initialisation
Move the job initialisation from main to jobs.
Change-Id: I8f5b54adb62e60592884ff1e3fad9811b5934d47
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 30 Mar 2017 11:33:11 +0000 (13:33 +0200)]
Fix concurrency issues on event manager
Having only one event manager is not possible
in multithreading due to the way that systemd
has to manage timer events. We observed that
timers were not armed when set in a thread
because event was polling in an other thread.
This patch provides more than one event manager
and at most as many as the number of threads
avalaible to start.
Change-Id: Iaeab353b7bc79ce61361ab73c7b197a9e69a6109
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Thu, 30 Mar 2017 09:19:42 +0000 (11:19 +0200)]
Refactor initialisation of the daemon
This commit prepares a future job centrered
main where 'sig_monitor_init', 'jobs_init',
'jobs_add_events', 'jobs_queue0' and 'jobs_add_me'
will be merged in one single call provided as
a feature of module jobs.
Change-Id: I8ccb1bf1761c4fa1031e903bead863ff68e7df83
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 29 Mar 2017 16:09:38 +0000 (18:09 +0200)]
Prepare migration to binding v2
Change-Id: I48c1fdb5199c9fb0f001576ceed3ddcb50fc9066
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 29 Mar 2017 15:41:16 +0000 (17:41 +0200)]
cosmetic
Change-Id: I26e35f99a68557d005ee46dd4cd1c0fbd728bfd2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 29 Mar 2017 15:39:23 +0000 (17:39 +0200)]
Prepare move to bindings version 2
Change-Id: I3105a5898d0703d1e57eff09f179b38742482842
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Wed, 29 Mar 2017 14:02:13 +0000 (16:02 +0200)]
Add comments
Improves the comments of the module jobs
Change-Id: Id99e9c6d6c9572d68ae9cca0f13e2498348de91d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 28 Mar 2017 15:46:32 +0000 (17:46 +0200)]
Refactor job to allow synchronous calls
The family of methods "jobs_invoke" make synchronous
job activation. It waits for the completion of the
job while still dispatching it internally and
providing the calling thread for processing any job
queued.
Change-Id: Id36a30789cc51245a7bbfca42f0122cf4ea623b2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Tue, 28 Mar 2017 08:18:06 +0000 (10:18 +0200)]
Fix bug in recycling jobs
The bug was creating an infinite loop starving
the system (or other possible horrific stuff).
Also updated the test.
Change-Id: Id71dd112d2ed4651ac8aa56d2c57b088d69b8655
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 27 Mar 2017 20:49:44 +0000 (22:49 +0200)]
Make main thread used for common jobs
This commit make the main thread behaving
like any other threads. The main loop
is shared across threads, the first one
without job taking it. The main event loop
now have the lowest priority. It is
activated only when no job is queued.
This has the good effect to not try to
overfill the queue of jobs.
Change-Id: I07cecc9d94a02134c63bc2a814db56e171ab719e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 27 Mar 2017 13:54:44 +0000 (15:54 +0200)]
Remove option readyfd
This option is no more useful. Instead it is
possible to use systemd notify feature.
Change-Id: I8dd286242d3dc74238ca0908e83072367874d19e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 27 Mar 2017 12:48:53 +0000 (14:48 +0200)]
Speed up accesses to session's cookies
Minor improvement to speed up refactored contextes.
Change-Id: I45c1c4b0cecec52d10c2b7c5cd8e738fd75b25d6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 27 Mar 2017 12:24:46 +0000 (14:24 +0200)]
Replace session's value with sessions's cookies
This is a simplifaction with the benefits of
only allocating needed memory and avoiding to
create indexes on apis (path to dynanic?).
Conversely it replaces a direct access with
a linear search.
Change-Id: Ibb130528ad8f23dfd6b420c228f51e181efb2664
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
José Bollo [Mon, 27 Mar 2017 10:00:12 +0000 (12:00 +0200)]
Implement dichotomic search of APIs
This is a small improvement but it costs
so few that it is welcome.
Change-Id: I96db79b17ec811582c8e5d1d512afacece284016
Signed-off-by: José Bollo <jose.bollo@iot.bzh>