Joris Vink
d9f543ef5b
Allow user-supplied tracer callback.
2018-11-29 09:51:24 +01:00
Joris Vink
b400fdcd9f
include sys/param.h in python.c
2018-11-29 09:11:31 +01:00
Joris Vink
fd1ab5879d
KODEV_OUTPUT tells kodev the outdir of the binary.
...
eg:
$ env KODEV_OUTPUT=/tmp kodev build
will place the resulting binary under /tmp/<binary>
2018-11-28 14:24:42 +01:00
Joris Vink
8dd075e71c
style
2018-11-28 14:22:27 +01:00
Joris Vink
e3efeb9465
Move assets.h into object_dir.
2018-11-28 14:19:32 +01:00
Joris Vink
34829d8592
Add OPENSSL_PATH environment variable.
2018-11-28 13:54:38 +01:00
Joris Vink
c431c2bf72
Add support to obtain peer certificate from Python
...
This will return the DER encoded bytes representing the peer certificate.
2018-11-28 11:28:07 +01:00
Joris Vink
6d78ae04b4
Add async socket example.
2018-11-23 22:34:09 +01:00
Joris Vink
a030a6fd38
update README
2018-11-22 15:24:08 +01:00
Joris Vink
c74c1f781d
Add python-async example.
2018-11-22 15:23:44 +01:00
Joris Vink
8b1a5add4b
update
2018-11-22 13:05:02 +01:00
Joris Vink
2d8874dd2a
change accept threshold default to 16.
2018-11-16 11:37:09 +01:00
Joris Vink
4e70636269
Reduce accept lock accept lockout time to 100ms.
2018-11-16 11:35:53 +01:00
Joris Vink
5c8efde841
allow foo.method symbols in python.
...
this way you can create page handlers that reside inside
of other objects.
eg:
static / restapi.index
2018-11-16 11:07:21 +01:00
Joris Vink
baafa4897e
Add -q flag.
...
If specified Kore will run quietly and only log important messages.
2018-11-15 16:01:37 +01:00
Joris Vink
cb482d8e8f
Always use http_response_stream() in req.response.
...
Keep around the python bytes object while we stream the contents
of it out over the wire. This avoids an entire copy of the data.
2018-11-14 10:03:32 +01:00
Joris Vink
966eaf8f7a
Add a kore_python_preinit() hook.
...
This is called before the python initialization is completed
and allows developers to inject their own built-in methods.
2018-11-12 09:01:05 +01:00
Joris Vink
3925ba60ad
don't call close() no underlying socket.
2018-11-12 09:00:36 +01:00
Joris Vink
4cc9e216bb
Don't call close() on the python socket on dealloc
2018-11-06 16:54:26 +01:00
Joris Vink
2dd66586ff
several python improvements.
...
- add kore.time() as equivalent for kore_time_ms().
- call waitpid() until no more children are available for reaping otherwise
we risk missing a process if several die at the same time and only one
SIGCHLD is delivered to us.
- drain a RECV socket operation if eof is set but no exception was given.
2018-10-30 20:28:27 +01:00
Joris Vink
5456f2e1d5
save/restore coro_running in pygather_op_dealloc().
2018-10-30 12:37:30 +01:00
Joris Vink
062c80c1ac
start enforcing a mininum number of elms in pools.
2018-10-30 10:41:49 +01:00
Joris Vink
71c145932c
grow kore_pools at a slower rate.
...
Before we just doubled in size the second we exhausted a pool instead
of doing a more controlled expansion.
Now we will expand at 25% of the initial elm count whenever we need to.
Will help with memory pressure in certain scenarios.
2018-10-30 10:36:18 +01:00
Joris Vink
ae2ea0be72
specify what openssl versions are expected to work.
2018-10-30 08:45:11 +01:00
Joris Vink
bb00deca2c
don't leak op in error path
2018-10-29 21:18:38 +01:00
Joris Vink
1c30da855c
Add kore.gather() to the python api.
...
Allows one to run coroutines concurrently and gather all their
results in a single returned list.
If any of the coroutines throw an exception the exception is
returned as the value of that coroutine in the returned list.
2018-10-29 21:16:08 +01:00
Joris Vink
740acb4760
make sure we can still build vs 1.1.0
2018-10-29 21:11:29 +01:00
Joris Vink
818c7847cd
simplify even more
2018-10-29 20:43:40 +01:00
Joris Vink
ae72b21d35
make sure older openssl/libressl builds work.
2018-10-29 20:42:28 +01:00
Joris Vink
339df66fd5
Add support for TLS 1.3 via OpenSSL 1.1.1.
...
This commit removes TLS 1.0 support no matter what OpenSSL
you are linking against.
Changes the value of tls_version from 1.2 to both. Meaning if
you link with OpenSSL 1.1.1 you will get 1.2 + 1.3.
2018-10-29 20:38:58 +01:00
Joris Vink
dda2e1fb2c
Some things still talk http/1.0.
2018-10-26 21:24:51 +02:00
Joris Vink
fc246e5552
defaults were changed
2018-10-26 19:24:51 +02:00
Joris Vink
e2651889e0
Add asynchronous subprocess support.
...
This adds kore.proc to the python runtime allowing async processing
handling:
The kore.proc method takes the command to run and an optional timeout
parameter in milliseconds. If the process did not exit normally after
that amount of time a TimeoutError exception is raised.
For instance:
async def run(cmd):
proc = kore.proc(cmd, 1000)
try:
await proc.send("hello")
proc.close_stdin()
except TimeoutError:
proc.kill()
retcode = await proc.reap()
return retcode
2018-10-26 19:19:47 +02:00
Joris Vink
ea7ea48840
actually just query for HW_NCPU on all BSDs.
2018-10-25 19:31:48 +02:00
Joris Vink
9d9e9dcec2
set cpu_count to 1 for unknown BSDs
2018-10-25 19:30:10 +02:00
Joris Vink
892814e353
Add kore_[parent|worker]_teardown().
...
If exists these functions are called when the worker is exiting
and when right before the parent exists.
Allows for cleanup code for applications if need to do cleanup on exit.
2018-10-23 21:46:34 +02:00
Joris Vink
fc5fc4f4ab
make sure timers don't go out of scope.
2018-10-23 21:36:19 +02:00
Joris Vink
8ea32983ae
Add kore.suspend(delay) to python.
...
Will suspend the coroutine for a number of milliseconds.
Example:
async def page(req):
await kore.suspend(1000)
req.response(200, b'')
2018-10-23 21:32:08 +02:00
Joris Vink
47776a9fbb
Hook kore timers into python.
2018-10-23 20:44:43 +02:00
Joris Vink
c41c1db303
Add kore_shutdown().
...
Allows workers to cleanly initiate a shutdown of the
entire server process.
2018-10-23 19:49:42 +02:00
Joris Vink
4c35073232
Use number of cpu cores if no worker count is set.
2018-10-22 21:27:17 +02:00
Joris Vink
b70d1ee80f
Add a locking mechanism in pykore.
...
Support the async with syntax:
lock = kore.lock()
async with lock:
# your block
Fix some small issues with other parts of the python system.
2018-10-22 20:09:23 +02:00
Joris Vink
1ac131c48f
If we hit the accept threshold, unlock worker.
2018-10-22 09:01:05 +02:00
Joris Vink
8be316ac0c
Let kore_worker_make_busy() set next_lock.
2018-10-22 09:00:55 +02:00
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