Commit Graph

1418 Commits

Author SHA1 Message Date
Joris Vink
fad5c6ea6f Give pyqueues "popnow". 2018-10-22 08:28:03 +02:00
Joris Vink
c8795b7d7f pyqueue improvements.
- cleanup queue if it gets deallocated.
- make sure waitables on a queue get removed if their pyqueue_op dies.
2018-10-21 21:58:34 +02:00
Joris Vink
4ae3d23c7e s/INCREF/DECREF 2018-10-18 22:24:58 +02:00
Joris Vink
0cda9ecfb0 Add an asynchronous queue mechanism.
This allows coroutines to submit messages to and pop
messages from a queue in an asynchronous way.
2018-10-18 22:15:21 +02:00
Joris Vink
b5958f7d7d Add kore_parent_daemonized().
This is called for single binaries after the parent
process has called daemon().

Also fix kore_parent_configure() for !single binaries.
2018-10-18 17:18:41 +02:00
Joris Vink
c2c4e55149 Makefile improvements.
Add KORE_PYTHON_LIB and KORE_PYTHON_INC which can be set
by a caller in case the libraries exist somewhere else.

Add KORE_CRYPTO to be able to override the name of the default
crypto library Kore would link with.
2018-10-17 11:31:36 +02:00
Joris Vink
c172d49567 kodev improvements.
- Take CFLAGS, CXXFLAGS and LDFLAGS from environment
  if present and append them to the build.conf cflags

- Allow overriding of the OBJDIR via KORE_OBJDIR.

- Allow overriding of build flavor via KORE_BUILD_FLAVOR.
2018-10-17 11:30:14 +02:00
Joris Vink
300daeadef fix comment 2018-10-16 13:17:44 +02:00
Joris Vink
29202d7330 Make kore_python_log_error() public.
While here also make kore_module_load() return the
kore_module data structure pointer it just added
to the modules list.
2018-10-16 13:16:36 +02:00
Joris Vink
6080bb1c35 echo server example in Python with new async/await. 2018-10-15 20:37:51 +02:00
Joris Vink
545d48e65d revert chunk that wasn't suppose to be changed. 2018-10-15 20:33:34 +02:00
Joris Vink
20a0103f1e Add async/await support for socket i/o in python.
This means you can now do things like:

	resp = await koresock.recv(1024)
	await koresock.send(resp)

directly from page handlers if they are defined as async.

Adds lots more to the python goo such as fatalx(), bind_unix(),
task_create() and socket_wrap().
2018-10-15 20:18:54 +02:00
Joris Vink
c12f296743 missing EPOLLRDHUP check since event loop rework 2018-10-10 14:33:26 +02:00
Joris Vink
c463ecb3cb Changes to the event loop inside of Kore.
Now anyone can schedule events and get a callback to work as long
as the user data structure that is added for the event begins
with a kore_event data structure.

All event state is now kept in that kore_event structure and renamed
CONN_[READ|WRITE]_POSSIBLE to KORE_EVENT_[READ|WRITE].
2018-10-09 19:34:40 +02:00
Joris Vink
2449a86085 missing addrtype -> family renames 2018-10-08 20:12:25 +02:00
Joris Vink
884d6d722e add listener to the list earlier. 2018-10-07 21:25:00 +02:00
Joris Vink
19044919b2 don't set nodelay on unix listener sockets 2018-10-07 21:21:37 +02:00
Joris Vink
20c4036e5f add bind_unix configuration option to example conf 2018-10-07 21:08:04 +02:00
Joris Vink
9427ed8a2e rename unix to sun 2018-10-07 21:03:12 +02:00
Joris Vink
442bdef79b allow kore to bind to unix sockets via bind_unix. 2018-10-07 20:49:16 +02:00
Joris Vink
f87624a459 Add missing KORE_NO_TLS guards.
Fixes NOTLS=1 builds on openssl 1.1.1
2018-10-01 10:36:33 +02:00
Joris Vink
7db3e4d946 fix compare match on db name.
from Kevin Lam via patches@
2018-09-19 07:18:46 +02:00
Remy Noulin
bfffa2d68d update kore.conf.example keymgr configuration 2018-09-10 09:01:05 +02:00
Joris Vink
ba8d6301b3 style 2018-08-30 09:13:11 +02:00
Joris Vink
566fefd031 do not http_argument_urldecode for multipart data. 2018-08-16 14:11:28 +02:00
Joris Vink
754ba47cc4 shuffle stuff around so we're not hitting bad juju. 2018-08-13 13:07:32 +02:00
Joris Vink
8d3f73bc71 call fatalx() instead of fatal() in certain cases. 2018-08-13 13:01:27 +02:00
Joris Vink
b0074ba45e Add fatalx().
If a worker process dies it automatically gets respawned by the
parent process, but sometimes you want the entire server to go down
if a worker encounters an error. This is what fatalx() does.

Calling fatalx() from a worker process will initiate a full shutdown
of the kore server you are running under.
2018-08-13 09:53:49 +02:00
Joris Vink
cf92097bc2 log what dir we can't chdir() into. 2018-08-13 09:53:38 +02:00
Joris Vink
6ef8d59f7d more directly include assets.h 2018-08-13 09:16:28 +02:00
Joris Vink
d1c8f95590 Show the reason why regcomp() failed if it does. 2018-08-10 08:06:09 +02:00
Joris Vink
03b927dd64 missing EPOLLET when we reschedule read/write 2018-08-01 12:17:16 +02:00
Joris Vink
a927acb7ee Add pledge support under OpenBSD.
All worker processes will now call pledge(2) after dropping
privileges (even if -rn was specified).

By default Kore will use the following promises:
	"stdio rpath inet error"

If your application requires more privileges, you can add more pledges
by setting them in your configuration using the 'pledge' directive:
	pledge dns wpath
2018-07-31 06:51:34 +02:00
Joris Vink
69922598e7 Missing EV_CLEAR for schedule read/write on BSD. 2018-07-30 15:58:47 +02:00
Joris Vink
5b3cee3428 Use a synchronous query to issue a ROLLBACK. 2018-07-28 22:28:19 +02:00
Joris Vink
43234cd36e be less spammy if stat fails with ENOENT. 2018-07-28 22:27:38 +02:00
Joris Vink
f126ba5a86 sprinkle more const around 2018-07-25 09:54:34 +02:00
Joris Vink
cf1f624367 let filerefs to operate on ms precision for mtime. 2018-07-24 19:56:36 +02:00
Joris Vink
a6e662a805 Add KORE_HTTP_STATE() helper macro.
defines as KORE_HTTP_STATE(f) (#f, f) so we can get a literal representing
the name of the state function which makes debugging a little easier.
2018-07-23 06:14:17 +02:00
Joris Vink
7f820c96e8 Make kore_auth_* public. 2018-07-19 10:28:38 +02:00
Joris Vink
821c1df8ec use method not allowed when required 2018-07-18 16:24:28 +02:00
Joris Vink
916ce222b4 better fix for 5a5d9fd0.
Don't let net_recv_flush() do things as long as the HTTP layer
owns the buffer. When we have sent a response kick the read end
back into gear ourselves by calling net_recv_flush().
2018-07-18 16:10:41 +02:00
Joris Vink
086e2e3d5e len is a size_t, not ssize_t 2018-07-18 16:09:05 +02:00
Joris Vink
25c8dfbdaa missing rpath pledge for openbsd 2018-07-18 15:14:07 +02:00
Joris Vink
5a5d9fd0c2 alloc space for nb->buf after taking ownership. 2018-07-18 14:36:13 +02:00
Joris Vink
27d1746940 Consume all notifications on a connection. 2018-07-18 11:40:59 +02:00
Joris Vink
2e321f14de Add KORE_PGSQL_STATE_NOTIFY.
Issue a LISTEN channel on a kore_pgsql, bind a callback to it and you
will get called with pgsql->state being KORE_PGSQL_STATE_NOTIFY.
2018-07-18 11:38:17 +02:00
Joris Vink
1447f6573f better http header validation. 2018-07-17 20:17:05 +02:00
Joris Vink
3312a2882f Let KORE_PREFIX override builtin prefix for kodev. 2018-07-17 15:59:59 +02:00
Joris Vink
05cccef77c toot toot 2018-07-17 15:16:27 +02:00