1
0
mirror of https://git.kore.io/kore.git synced 2024-11-12 13:19:12 +01:00
Commit Graph

1125 Commits

Author SHA1 Message Date
Joris Vink
f59e94a7b6 Add spdy_session_teardown() which can properly teardown a SPDY session.
Use this throughout the spdy code to propagate session errors (if any) occur.

At the same time fix BSD's missing CONN_WRITE_BLOCK
2013-07-13 19:56:38 +02:00
Joris Vink
777cfda791 More stuff todo, woop. 2013-07-13 19:02:16 +02:00
Joris Vink
0fee1247c9 TAILQ_REMOVE() the netbuf before adding it to the HEAD of recv_queue again. 2013-07-12 15:49:49 +02:00
Joris Vink
2e3720abc9 free() -> kore_mem_free() 2013-07-12 10:49:37 +02:00
Joris Vink
5d0b82030d Add FreeBSD 2013-07-11 23:01:54 +02:00
Joris Vink
9eb32e668e use correct base64 alphabet (URL and Filename Safe Alphabet) 2013-07-10 15:04:01 +02:00
Joris Vink
bb09e8b2a9 add base64 encoder/decoder in prep for http/2.0 and websockets 2013-07-10 15:00:53 +02:00
Joris Vink
bb2d4903f2 remove NETBUF_RETAIN, no longer needed 2013-07-10 13:39:35 +02:00
Joris Vink
21a44589fc If we already have all the POST data in the netbuf do not try and read more. 2013-07-10 13:34:42 +02:00
Joris Vink
0ebcbe4f18 Merge remote branch 'origin/master' 2013-07-10 10:38:52 +02:00
Joris Vink
36d603ea67 When negotiating the protocol to be used using the NPN extension keep in mind that http/1.1 can be given there as well. (Googlebot does this, and thus couldn't access Kore sites).
On top of that be extra careful with how many bytes we memcmp() if we receive data from the NPN extension.

This fix makes googlebot and anybody negotiating http/1.1 over NPN properly.
2013-07-10 10:37:37 +02:00
Joris Vink
9b1f0a3fab add a skeleton framework for creating new modules. 2013-07-10 09:28:00 +02:00
Joris Vink
fa78d24948 remove WILLCLOSE, no longer needed 2013-07-09 15:23:33 +02:00
Joris Vink
94eee6a8d1 - Do not wrongly ignore WINDOW_UPDATE frames when a stream is still active.
- Only unblock a stream if it was actually blocked before.
2013-07-09 15:21:48 +02:00
Joris Vink
b0c67df902 fix a typo 2013-07-09 13:27:39 +02:00
Joris Vink
a17f93e896 Include sys/types.h and unistd.h for close(), getopt(), getpid(),
getuid(), setproctitle(), unlink() and declaration of optarg.

Makes Kore compatible with FreeBSD too.

From Ayan George <ayan@ayan.net>
2013-07-09 09:45:16 +02:00
Joris Vink
35b71353d5 update TODO list 2013-07-07 15:08:47 +02:00
Joris Vink
649e81afd7 use handler function name if available when logging a worker process that has died. 2013-07-07 14:56:50 +02:00
Joris Vink
95bacb5690 Kore will now keep track of page handlers that cause workers to die.
This is useful to track down any issues you might have in your module.

A log entry with a page handler causing issues looks like:
Jul  7 14:44:30 devbook kore[18191]: [parent]: worker 1 (18193)-> status 11
Jul  7 14:44:30 devbook kore[18191]: [parent]: worker 1 (pid: 18193) (hdlr: 0x242d9c0) gone
Jul  7 14:44:30 devbook kore[18191]: [parent]: hdlr serve_intro has caused 2 error(s)
2013-07-07 14:48:32 +02:00
Joris Vink
7df5339c8d Properly fix bsd.c, sigh. 2013-07-06 21:05:17 +02:00
Joris Vink
354a3f1ad1 Fix header includes in the module example as well, from Ewan Higgs via github. 2013-07-06 21:00:48 +02:00
Joris Vink
c1723f2db5 Clean up header includes, based on a diff from Ewan Higgs via github.
And while we're messing in it, make sure bsd.c compiles again.
2013-07-06 20:55:22 +02:00
Joris Vink
bbc98cf2a7 Add MODULE_BUILD_DATE to static.h when building.
Contains %Y-%m-%d %H-%M-%S timestamp of when the module was built.
2013-07-06 18:07:06 +02:00
Joris Vink
1c8cfff1a9 add websocket support and more onto TODO list 2013-07-06 04:29:24 +02:00
Joris Vink
886c3920db sysconf() returns -1 on failure, cpu_count is an unsigned integer, failure would never have been caught.
from cremno via github
2013-07-05 22:17:56 +02:00
Joris Vink
87d8fd784b do not attempt to log the user-agent if it's not available. 2013-07-05 22:03:05 +02:00
Joris Vink
51efd84b6e also set has_lock to 0 when a worker starts. 2013-07-05 21:17:08 +02:00
Joris Vink
e1183e22a6 If the worker that owns the accept lock dies, make sure the next one in line can grab it. Otherwise kore comes to a halt (by not accepting new connections). 2013-07-05 20:19:50 +02:00
Joris Vink
eb43fd31e1 remove unused stuff 2013-07-05 16:02:03 +02:00
Joris Vink
69df62f0ea when receiving SETTINGS verify that the number of settings received by
the client matches the length of the SPDY frame we received.
Otherwise bad clients could potentially cause us to misbehave.
2013-07-01 12:34:18 +02:00
Joris Vink
0c08b57d3e - add idle timer for normal connections (ie: !SPDY), max 20 seconds.
- use idle timer to make sure we don't block SPDY connections indefinately
  when our window size has reached 0.
2013-07-01 12:08:51 +02:00
Joris Vink
a2392e645f use kore_mem_free() in example module 2013-07-01 11:52:45 +02:00
Joris Vink
51a9e4db9d Implement SPDY WINDOW_UPDATE and SETTINGS. 2013-07-01 11:30:18 +02:00
Joris Vink
6fa881e224 SSL_set_accept_state() when a new SSL * is created 2013-06-27 12:37:42 +02:00
Joris Vink
108a0cbc81 remove unneeded blocks of code 2013-06-27 12:37:27 +02:00
Joris Vink
3c6169a861 bring bsd into sync 2013-06-27 12:37:14 +02:00
Joris Vink
a1342c93d5 remove memid from meminfo 2013-06-27 12:27:17 +02:00
Joris Vink
f18a6388fd fix kore_realloc() to actually behave properly 2013-06-27 09:20:48 +02:00
Joris Vink
4b2420097b - Better spread load between all worker processes.
- Introduce own memory management system on top of malloc to keep track
  of all our allocations and free's. Later we should introduce a pooling
  mechanism for fixed size allocations (http_request comes to mind).
- Introduce ssl_cipher in configuration.

Memory usage is kind of high right now, but it seems its OpenSSL
doing it rather then Kore.
2013-06-27 08:46:18 +02:00
Joris Vink
7828bd0cfc add ssl_cipher 2013-06-27 08:46:01 +02:00
Joris Vink
b4a0330a96 - Better spread load between all worker processes.
- Introduce own memory management system on top of malloc to keep track
  of all our allocations and free's. Later we should introduce a pooling
  mechanism for fixed size allocations (http_request comes to mind).
- Introduce ssl_cipher in configuration.

Memory usage is kind of high right now, but it seems its OpenSSL
doing it rather then Kore.
2013-06-27 08:43:07 +02:00
Joris Vink
1582528ba5 Merge remote-tracking branch 'origin/master' 2013-06-27 00:32:16 +02:00
Joris Vink
2fc5233358 Rework the way worker processes give each other the accept lock.
Instead of waiting until one worker is filled up on connections
the workers find the next lowest loaded worker and will hand
over the lock to them instead. This will cause a nicer spread of load.

Instead of running one accept per event loop, we attempt to accept
as many as worker_max_connections allows.

Refactor net sending/recv code a bit.
2013-06-27 00:22:48 +02:00
Joris Vink
1412449fe7 skip certain files when building 2013-06-26 19:15:49 +02:00
Joris Vink
f707749cf4 no longer hold static openssl libs in the repo. 2013-06-26 19:05:54 +02:00
Joris Vink
124f3ecad9 no need to use kore_log() in a debug context 2013-06-26 15:59:42 +02:00
Joris Vink
113dbaba53 reset worker_max_connections back to default 2013-06-26 15:58:09 +02:00
Joris Vink
bf1940225a everybody loves to tout their own horn.. so introduce a server response header 2013-06-26 16:58:01 +02:00
Joris Vink
7a2e855d28 set tstamp to 0 in the correct location 2013-06-26 16:57:34 +02:00
Joris Vink
0dda6f996f Add a form of synchronization between what worker will be accepting
new connections and which ones will not be notified for it.

Fixes the thundering herd problem, and nicely spreads out load between
all the workers equally. A configuration option (workers_max_connections)
is available to tweak how many connections a worker will have before
giving up the accept lock.

Two ways are added to this commit for access locking:
- Locking via semaphores.
- Locking via GCC's builtin atomic methods.

The default is running with semaphores disabled (OpenBSD cannot do
sem_init() with pshared set to 1, which is required).

If you want to use semaphores add KORE_USE_SEMAPHORES to CFLAGS,
and -lpthread to LDFLAGS in the Makefile.

Other fixes:
- BSD: add a timeout to kevent().
- Merge kore_worker_wait together, linux knows waitpid() as well.
- Send the correct SIGQUIT signal to workers instead of SIGINT.
- Fix kore_time_ms().
- Log fatal worker messages in syslog.
- Refactor code even more.
- Do not free our own kore_worker structure.
2013-06-26 16:37:22 +02:00