Code

sysdb.git
10 years ago.gitignore: Ignore sysdb / sysdbd only as src/sysdb / src/sysdbd.
Sebastian Harl [Sun, 15 Dec 2013 15:43:52 +0000 (16:43 +0100)]
.gitignore: Ignore sysdb / sysdbd only as src/sysdb / src/sysdbd.

10 years agoMoved connection-private.h from src/include/frontend/ to src/frontend/.
Sebastian Harl [Sun, 15 Dec 2013 15:40:37 +0000 (16:40 +0100)]
Moved connection-private.h from src/include/frontend/ to src/frontend/.

This header is not meant to be used anyway else, so don't lead people into
temptation.

10 years agoMoved sysdb and sysdbd sources to src/tools/.
Sebastian Harl [Sun, 15 Dec 2013 15:36:41 +0000 (16:36 +0100)]
Moved sysdb and sysdbd sources to src/tools/.

Also, moved all purely private headers to that directory as well.
Renamed some files for greater consistency.

10 years ago.gitignore: Ignore ar-lib.
Sebastian Harl [Sun, 15 Dec 2013 08:50:40 +0000 (09:50 +0100)]
.gitignore: Ignore ar-lib.

10 years agosysdb: Use a string buffer and simple (stupid) ';' EO-query checks.
Sebastian Harl [Sun, 15 Dec 2013 08:49:10 +0000 (09:49 +0100)]
sysdb: Use a string buffer and simple (stupid) ';' EO-query checks.

Use a different prompt (similar to psql) when inside a query.

10 years agoconfigure: Fixed some automake warnings.
Sebastian Harl [Sun, 15 Dec 2013 08:46:32 +0000 (09:46 +0100)]
configure: Fixed some automake warnings.

10 years agodoc/Makefile: Use SUFFIXES rather than GNU-specific %-style rules.
Sebastian Harl [Sun, 15 Dec 2013 08:46:01 +0000 (09:46 +0100)]
doc/Makefile: Use SUFFIXES rather than GNU-specific %-style rules.

10 years agostrbuf_test: Added tests for sdb_strbuf_clear().
Sebastian Harl [Fri, 13 Dec 2013 13:57:40 +0000 (14:57 +0100)]
strbuf_test: Added tests for sdb_strbuf_clear().

10 years agostrbuf_test: Added a couple of tests operating on a zero-size buffer.
Sebastian Harl [Fri, 13 Dec 2013 13:53:02 +0000 (14:53 +0100)]
strbuf_test: Added a couple of tests operating on a zero-size buffer.

This is mostly about checking that this does not crash.

10 years agostrbuf utils: Added sdb_strbuf_clear().
Sebastian Harl [Fri, 13 Dec 2013 13:44:54 +0000 (14:44 +0100)]
strbuf utils: Added sdb_strbuf_clear().

10 years agosysdb: Free memory allocated by readline().
Sebastian Harl [Fri, 13 Dec 2013 13:36:38 +0000 (14:36 +0100)]
sysdb: Free memory allocated by readline().

10 years agosysdb: Don't warn about missing history file when loading history.
Sebastian Harl [Fri, 13 Dec 2013 13:33:13 +0000 (14:33 +0100)]
sysdb: Don't warn about missing history file when loading history.

10 years agosysdb: Check for and use libedit/libreadline for command input.
Sebastian Harl [Fri, 13 Dec 2013 13:31:22 +0000 (14:31 +0100)]
sysdb: Check for and use libedit/libreadline for command input.

10 years agodbi utils: Don't keep invalid object address after closing DBI connections.
Sebastian Harl [Fri, 13 Dec 2013 13:29:42 +0000 (14:29 +0100)]
dbi utils: Don't keep invalid object address after closing DBI connections.

10 years agofrontend: Remove stale UNIX sockets before trying to bind().
Sebastian Harl [Wed, 11 Dec 2013 10:26:24 +0000 (11:26 +0100)]
frontend: Remove stale UNIX sockets before trying to bind().

10 years agoclient: Report client socket errors using error utils.
Sebastian Harl [Wed, 11 Dec 2013 10:16:35 +0000 (11:16 +0100)]
client: Report client socket errors using error utils.

10 years agosysdb: Exit, if the current user could not be determined.
Sebastian Harl [Wed, 11 Dec 2013 10:09:04 +0000 (11:09 +0100)]
sysdb: Exit, if the current user could not be determined.

10 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.
Sebastian Harl [Tue, 10 Dec 2013 19:29:28 +0000 (20:29 +0100)]
Merged branch 'master' of git://git.tokkee.org/sysdb.

10 years agosysdb: Use error utilities.
Sebastian Harl [Tue, 10 Dec 2013 19:28:47 +0000 (20:28 +0100)]
sysdb: Use error utilities.

10 years agoerror utils: Make the logger callback configurable.
Sebastian Harl [Tue, 10 Dec 2013 18:13:37 +0000 (19:13 +0100)]
error utils: Make the logger callback configurable.

Don't depend on the plugin module anymore. Rather, add sdb_error_set_logger()
which may be used to set a callback to be used for all logging. Default to
printing to stderr.

sysdbd now uses that to register sdb_plugin_log as logger callback.

10 years agoMoved core/error to utils/error.
Sebastian Harl [Tue, 10 Dec 2013 17:56:59 +0000 (18:56 +0100)]
Moved core/error to utils/error.

Later, we'll use the module from the daemon and client.

10 years agosysdb: Connect to the server and issue a STARTUP command.
Sebastian Harl [Tue, 10 Dec 2013 17:49:38 +0000 (18:49 +0100)]
sysdb: Connect to the server and issue a STARTUP command.

The current username is sent along with the STARTUP command.

10 years agosysdbd: Send SIGINT to backend thread when shutting down.
Sebastian Harl [Tue, 10 Dec 2013 08:16:35 +0000 (09:16 +0100)]
sysdbd: Send SIGINT to backend thread when shutting down.

This will interrupt the sleep call and make the thread shut down faster.

10 years agoproto utils: Fixed offset check in get_int().
Sebastian Harl [Tue, 10 Dec 2013 08:11:53 +0000 (09:11 +0100)]
proto utils: Fixed offset check in get_int().

10 years agoLet sdb_client_connect() send a username to the server.
Sebastian Harl [Mon, 9 Dec 2013 08:34:23 +0000 (09:34 +0100)]
Let sdb_client_connect() send a username to the server.

… using a STARTUP message.

10 years agofrontend: Split connection status constants into a separate header.
Sebastian Harl [Mon, 9 Dec 2013 08:33:44 +0000 (09:33 +0100)]
frontend: Split connection status constants into a separate header.

This will allow the client to use it as well.

10 years agostore_test: Fixed golden data for tojson() test.
Sebastian Harl [Sat, 7 Dec 2013 15:29:25 +0000 (16:29 +0100)]
store_test: Fixed golden data for tojson() test.

10 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.
Sebastian Harl [Sat, 7 Dec 2013 15:23:44 +0000 (16:23 +0100)]
Merged branch 'master' of git://git.tokkee.org/sysdb.

10 years agostore_test: Added a test for tojson().
Sebastian Harl [Sat, 7 Dec 2013 15:23:17 +0000 (16:23 +0100)]
store_test: Added a test for tojson().

10 years agostore: tojson(): Comma-separate multiple hosts.
Sebastian Harl [Sat, 7 Dec 2013 15:12:23 +0000 (16:12 +0100)]
store: tojson(): Comma-separate multiple hosts.

10 years agoRun all tests using TZ=UTC.
Sebastian Harl [Sat, 7 Dec 2013 15:06:16 +0000 (16:06 +0100)]
Run all tests using TZ=UTC.

This will ensure consistent time formatting.

10 years agot/core/store_test: Added initial tests for the object store.
Sebastian Harl [Sat, 7 Dec 2013 14:46:21 +0000 (15:46 +0100)]
t/core/store_test: Added initial tests for the object store.

For now, testing basic insertion operations.

10 years agostore: Don't try to update non-existent attributes.
Sebastian Harl [Sat, 7 Dec 2013 14:43:06 +0000 (15:43 +0100)]
store: Don't try to update non-existent attributes.

10 years agoobject_test: Added test for sdb_object_cmp_by_name().
Sebastian Harl [Sat, 7 Dec 2013 14:05:08 +0000 (15:05 +0100)]
object_test: Added test for sdb_object_cmp_by_name().

10 years agoobject_test: Added tests for wrapped object and memory management.
Sebastian Harl [Sat, 7 Dec 2013 13:56:14 +0000 (14:56 +0100)]
object_test: Added tests for wrapped object and memory management.

10 years agoUpdated various copyright notices to 2012-2013.
Sebastian Harl [Thu, 5 Dec 2013 17:41:40 +0000 (18:41 +0100)]
Updated various copyright notices to 2012-2013.

10 years agosysdbd: Changed -d option to -D and default to daemonizing the process.
Sebastian Harl [Thu, 5 Dec 2013 17:39:03 +0000 (18:39 +0100)]
sysdbd: Changed -d option to -D and default to daemonizing the process.

It doesn't really matter much what the default is but -d should be reserved
for debugging.

10 years agosysdbd: Fixed a typo.
Sebastian Harl [Thu, 5 Dec 2013 17:33:10 +0000 (18:33 +0100)]
sysdbd: Fixed a typo.

10 years agosysdb: Added a initial client implementation.
Sebastian Harl [Thu, 5 Dec 2013 17:31:36 +0000 (18:31 +0100)]
sysdb: Added a initial client implementation.

For now, this is basically a placeholder.

10 years agoclient: Let client_recv() read a full response.
Sebastian Harl [Thu, 5 Dec 2013 17:26:16 +0000 (18:26 +0100)]
client: Let client_recv() read a full response.

… and block if necessary. There is no reason that a client should handle
partial responses.

10 years agoclient: Let client_recv() not pass unparsed status,len to the caller.
Sebastian Harl [Thu, 5 Dec 2013 17:21:01 +0000 (18:21 +0100)]
client: Let client_recv() not pass unparsed status,len to the caller.

10 years agostrbuf_test: Added skip() tests using various offsets.
Sebastian Harl [Thu, 5 Dec 2013 17:17:00 +0000 (18:17 +0100)]
strbuf_test: Added skip() tests using various offsets.

10 years agoutil strbuf: Let skip() support an offset.
Sebastian Harl [Thu, 5 Dec 2013 08:09:41 +0000 (09:09 +0100)]
util strbuf: Let skip() support an offset.

That is, add support for removing bytes from the middle of the buffer.

10 years agoAdded version functions to libsysdbclient.
Sebastian Harl [Thu, 5 Dec 2013 07:58:48 +0000 (08:58 +0100)]
Added version functions to libsysdbclient.

This is basically the same as the sdb_version() functions but to be used only
in the client lib.

10 years agoLink proto and strbuf utilities into libsysdbclient.
Sebastian Harl [Thu, 5 Dec 2013 07:58:01 +0000 (08:58 +0100)]
Link proto and strbuf utilities into libsysdbclient.

10 years agoAdded initial client library implementation.
Sebastian Harl [Wed, 4 Dec 2013 18:42:45 +0000 (19:42 +0100)]
Added initial client library implementation.

For now, this includes a network client only.

10 years agoutils proto: Added sdb_proto_get_int().
Sebastian Harl [Wed, 4 Dec 2013 18:32:50 +0000 (19:32 +0100)]
utils proto: Added sdb_proto_get_int().

This function “recieves” a 32bit integer from a string buffer and converts it
from network to host byte order.

10 years agoutils proto: Added utility functions for protocol handling.
Sebastian Harl [Wed, 4 Dec 2013 10:06:39 +0000 (11:06 +0100)]
utils proto: Added utility functions for protocol handling.

So far, added functions to send data to an open file descriptor and use that
in the frontend code.

10 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.
Sebastian Harl [Sun, 1 Dec 2013 16:34:48 +0000 (17:34 +0100)]
Merged branch 'master' of git://git.tokkee.org/sysdb.

Conflicts:
t/Makefile.am
t/libsysdb_test.c
t/libsysdb_test.h

10 years ago.gitignore: Added check test logs.
Sebastian Harl [Sun, 1 Dec 2013 16:02:06 +0000 (17:02 +0100)]
.gitignore: Added check test logs.

10 years agot/: Added initial tests for core/object.
Sebastian Harl [Sun, 1 Dec 2013 16:01:15 +0000 (17:01 +0100)]
t/: Added initial tests for core/object.

10 years agoobject: Be more specific about requirements for the 'destroy' callback.
Sebastian Harl [Sun, 1 Dec 2013 15:57:14 +0000 (16:57 +0100)]
object: Be more specific about requirements for the 'destroy' callback.

10 years agoobject: Ensure that a type's destroy callback is called if init fails.
Sebastian Harl [Sun, 1 Dec 2013 15:55:13 +0000 (16:55 +0100)]
object: Ensure that a type's destroy callback is called if init fails.

Else, failed init may leak memory.

10 years agofrontend: Unified error reporting to the client.
Sebastian Harl [Thu, 28 Nov 2013 17:28:26 +0000 (18:28 +0100)]
frontend: Unified error reporting to the client.

Keep track of the latest error in a connection object and report that back to
the client in case a command handler failed.

10 years agostore: Let tojson() embed errors into JSON rather than aborting.
Sebastian Harl [Thu, 28 Nov 2013 17:17:28 +0000 (18:17 +0100)]
store: Let tojson() embed errors into JSON rather than aborting.

10 years agoRenamed sdb_session_start() to sdb_fe_session_start().
Sebastian Harl [Thu, 28 Nov 2013 16:50:56 +0000 (17:50 +0100)]
Renamed sdb_session_start() to sdb_fe_session_start().

10 years agofrontend: Added a simple 'LIST' command.
Sebastian Harl [Thu, 28 Nov 2013 16:48:48 +0000 (17:48 +0100)]
frontend: Added a simple 'LIST' command.

This command sends a JSON representation of the whole store to the client.

10 years agostore: Replaced store_dump() with store_tojson().
Sebastian Harl [Thu, 28 Nov 2013 16:47:04 +0000 (17:47 +0100)]
store: Replaced store_dump() with store_tojson().

The new function serializes the store as JSON and writes the result to a
string buffer.

10 years agostrbuf test: Further extended the incremental append test.
Sebastian Harl [Thu, 28 Nov 2013 16:42:06 +0000 (17:42 +0100)]
strbuf test: Further extended the incremental append test.

10 years agoutils strbuf: Handle nul-byte correctly.
Sebastian Harl [Thu, 28 Nov 2013 16:34:56 +0000 (17:34 +0100)]
utils strbuf: Handle nul-byte correctly.

A corner-case was not handled correctly before: when writing just enough
characters to the buffer that it would then be full, a resize was attempted
without changing the size of the buffer, leading to an endless loop in
vappend(). This was caused by not taking into account the space required for
the trailing nul-byte.

A test-case which exposes this problem has also been added.

10 years agosrc/Makefile: Install all public header files.
Sebastian Harl [Tue, 26 Nov 2013 17:47:37 +0000 (18:47 +0100)]
src/Makefile: Install all public header files.

10 years agofrontend: Moved all connection handling operations into connection.c.
Sebastian Harl [Tue, 26 Nov 2013 17:42:58 +0000 (18:42 +0100)]
frontend: Moved all connection handling operations into connection.c.

connection_obj_t was merged into sdb_conn_t which now inherits from
sdb_object_t. The connection object is now private to the library and defined
in the new header file connection-private.h.

10 years agofrontend: Report back invalid commands.
Sebastian Harl [Sat, 23 Nov 2013 08:59:14 +0000 (09:59 +0100)]
frontend: Report back invalid commands.

10 years agofrontend: Handle STARTUP and PING commands.
Sebastian Harl [Sat, 23 Nov 2013 08:50:50 +0000 (09:50 +0100)]
frontend: Handle STARTUP and PING commands.

Implemented an initial, trivial "framework" for session handling /
authentication. Simply send back OK status for now.

Fixed preconditions for initialization and handling of commands.

10 years agofrontend: Moved connection init/close to connection.c.
Sebastian Harl [Tue, 12 Nov 2013 16:39:53 +0000 (17:39 +0100)]
frontend: Moved connection init/close to connection.c.

10 years agofrontend/sock: Fixed an info message.
Sebastian Harl [Mon, 11 Nov 2013 08:25:46 +0000 (09:25 +0100)]
frontend/sock: Fixed an info message.

;-)

10 years agofrontend/connection: Reset state after handling a command.
Sebastian Harl [Mon, 11 Nov 2013 08:22:21 +0000 (09:22 +0100)]
frontend/connection: Reset state after handling a command.

10 years agofrontend/connection: Try to handle as much as possible in read().
Sebastian Harl [Mon, 11 Nov 2013 08:18:13 +0000 (09:18 +0100)]
frontend/connection: Try to handle as much as possible in read().

Else, we might have to wait for more data before being able to process a
command.

10 years agofrontend: Added module for generic connection handling.
Sebastian Harl [Mon, 11 Nov 2013 08:17:31 +0000 (09:17 +0100)]
frontend: Added module for generic connection handling.

10 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.
Sebastian Harl [Thu, 7 Nov 2013 14:47:07 +0000 (15:47 +0100)]
Merged branch 'master' of git://git.tokkee.org/sysdb.

10 years agosocket frontend: Notify about incomplete commands before closing connections.
Sebastian Harl [Thu, 7 Nov 2013 06:49:44 +0000 (07:49 +0100)]
socket frontend: Notify about incomplete commands before closing connections.

10 years agoutils strbuf: Advance buffer position in sdb_strbuf_read().
Sebastian Harl [Thu, 7 Nov 2013 06:48:59 +0000 (07:48 +0100)]
utils strbuf: Advance buffer position in sdb_strbuf_read().

10 years agosocket frontend: Read incoming commands into a buffer.
Sebastian Harl [Wed, 6 Nov 2013 21:25:53 +0000 (22:25 +0100)]
socket frontend: Read incoming commands into a buffer.

Handle commands once all of them has been read. Give preference to reading
data over handling a command in order not to block clients or exhaust
operating system buffers.

10 years agostrbuf_test: Added some NULL tests.
Sebastian Harl [Thu, 31 Oct 2013 18:09:05 +0000 (19:09 +0100)]
strbuf_test: Added some NULL tests.

These are mainly to check that the functions do no segfault but report an
error.

10 years agostrbuf_test: Added tests for len / nil-termination after skip().
Sebastian Harl [Thu, 31 Oct 2013 18:00:50 +0000 (19:00 +0100)]
strbuf_test: Added tests for len / nil-termination after skip().

10 years agoutils strbuf: Added sdb_strbuf_skip().
Sebastian Harl [Thu, 31 Oct 2013 17:56:06 +0000 (18:56 +0100)]
utils strbuf: Added sdb_strbuf_skip().

This function may be used to remove bytes and the beginning of the buffer.

10 years agosocket frontend: Merged connection_obj_t and connection_t.
Sebastian Harl [Wed, 30 Oct 2013 10:16:48 +0000 (11:16 +0100)]
socket frontend: Merged connection_obj_t and connection_t.

There's no reason for two separate structs.

10 years agoutils strbuf: Added sdb_strbuf_read().
Sebastian Harl [Tue, 29 Oct 2013 09:06:42 +0000 (10:06 +0100)]
utils strbuf: Added sdb_strbuf_read().

This function may be used to read from an open file into the buffer.

10 years agoutils strbuf: Added memcpy and memappend functions.
Sebastian Harl [Tue, 29 Oct 2013 08:47:57 +0000 (09:47 +0100)]
utils strbuf: Added memcpy and memappend functions.

These functions may be used to write arbitrary data to a string buffer.

10 years agosocket frontend: Cleaned up main handler loop a bit.
Sebastian Harl [Sat, 26 Oct 2013 12:23:56 +0000 (14:23 +0200)]
socket frontend: Cleaned up main handler loop a bit.

10 years agosocket frontend: Try to reopen a connection if it has been closed.
Sebastian Harl [Sat, 26 Oct 2013 12:14:11 +0000 (14:14 +0200)]
socket frontend: Try to reopen a connection if it has been closed.

10 years agosocket frontend: Close sockets on error as well.
Sebastian Harl [Sat, 26 Oct 2013 12:10:04 +0000 (14:10 +0200)]
socket frontend: Close sockets on error as well.

10 years agosocket frontend: Close listening sockets before returning.
Sebastian Harl [Sat, 26 Oct 2013 12:05:42 +0000 (14:05 +0200)]
socket frontend: Close listening sockets before returning.

Also, cleaned up listener handling a bit.

10 years agosocket frontend: Disallow duplicate listen_and_serve() calls.
Sebastian Harl [Sat, 26 Oct 2013 11:51:06 +0000 (13:51 +0200)]
socket frontend: Disallow duplicate listen_and_serve() calls.

… and fixed a memory leak.

10 years agosocket frontend: Don't use UTF-8 in comments ;-)
Sebastian Harl [Fri, 25 Oct 2013 17:07:17 +0000 (19:07 +0200)]
socket frontend: Don't use UTF-8 in comments ;-)

10 years agosocket frontend: Let handler read from open connection.
Sebastian Harl [Fri, 25 Oct 2013 17:04:56 +0000 (19:04 +0200)]
socket frontend: Let handler read from open connection.

Close the connection on EOF and pass back the connection to the main loop in
case no data is currently available (read() would block).

10 years agosocket frontend: Pass socket object to handler threads.
Sebastian Harl [Fri, 25 Oct 2013 17:03:32 +0000 (19:03 +0200)]
socket frontend: Pass socket object to handler threads.

This will allow them to pass back connections to the main loop.

10 years agosocket frontend: Renamed accept_connection → connection_accept.
Sebastian Harl [Fri, 25 Oct 2013 16:59:40 +0000 (18:59 +0200)]
socket frontend: Renamed accept_connection → connection_accept.

10 years agosocket frontend: Use nonblocking I/O for open connections.
Sebastian Harl [Fri, 25 Oct 2013 16:57:28 +0000 (18:57 +0200)]
socket frontend: Use nonblocking I/O for open connections.

10 years agosocket frontend: Split connection accepting into its own function.
Sebastian Harl [Fri, 25 Oct 2013 15:50:17 +0000 (17:50 +0200)]
socket frontend: Split connection accepting into its own function.

10 years agosocket frontend: Manage open connections in listen_and_serve().
Sebastian Harl [Fri, 25 Oct 2013 15:40:57 +0000 (17:40 +0200)]
socket frontend: Manage open connections in listen_and_serve().

For that purpose, added a new object data type wrapping a connection. All open
connections are managed in a linked-link in the socket object. The main loop
now also waits data to be available on an open connection and then passed on
the connection object to the connection handler thread which is then supposed
to handle requests (not implemented yet).

10 years agochannel_test: Updated timeout check according to latest changes.
Sebastian Harl [Fri, 25 Oct 2013 15:30:12 +0000 (17:30 +0200)]
channel_test: Updated timeout check according to latest changes.

I.e. check errno rather than the return value.

10 years agoutils llist: Added sdb_llist_iter_remove_current().
Sebastian Harl [Fri, 25 Oct 2013 15:23:32 +0000 (17:23 +0200)]
utils llist: Added sdb_llist_iter_remove_current().

This function may be used to remove the current (the one returned by the last
sdb_llist_iter_get_next() call) iterator value from the list.

Note, that this function is not safe if another iterator is used in parallel
at the same time.

10 years agoMade log prefixes slightly more generic.
Sebastian Harl [Tue, 22 Oct 2013 16:53:34 +0000 (18:53 +0200)]
Made log prefixes slightly more generic.

Changed "plugin" to "core" and "sock" to "frontend". Those names better
identify the context in which the error happened.

10 years agodaemon: Terminate backend thread after frontends have stopped.
Sebastian Harl [Tue, 22 Oct 2013 07:10:38 +0000 (09:10 +0200)]
daemon: Terminate backend thread after frontends have stopped.

10 years agodaemon: Exit if adding a listener fails.
Sebastian Harl [Tue, 22 Oct 2013 07:08:37 +0000 (09:08 +0200)]
daemon: Exit if adding a listener fails.

10 years agosocket frontend: Improved error reporting.
Sebastian Harl [Tue, 22 Oct 2013 07:00:55 +0000 (09:00 +0200)]
socket frontend: Improved error reporting.

10 years agodaemon: Added "Listen" config option.
Sebastian Harl [Tue, 22 Oct 2013 06:54:20 +0000 (08:54 +0200)]
daemon: Added "Listen" config option.

The main thread listens on all configured addresses and serves requests
through the frontend socket module. The backend collector loop now runs in its
own background thread.

10 years agofrontend: Use channel shutdown to synchronize handler thread shutdown.
Sebastian Harl [Mon, 21 Oct 2013 07:15:24 +0000 (09:15 +0200)]
frontend: Use channel shutdown to synchronize handler thread shutdown.

This allows the handler to fully control the shutdown procedure.
pthread_cancel did not play well with pthread_cond_*wait in multiple threads
and the respective locked mutex.

10 years agoutils channel: Added sdb_channel_shutdown().
Sebastian Harl [Mon, 21 Oct 2013 07:10:08 +0000 (09:10 +0200)]
utils channel: Added sdb_channel_shutdown().

This function initiates a shutdown of the channel, forbidding any subsequent
writes. However, readers are still able to empty the buffer. Then, EBADF will
be returned through errno. This allows for graceful shutdowns.