mk_config: Parse multiple Listen configuration options.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
en/mconf: Removes Port and changes Listen directives.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
utils: Use first listen port on pid file name.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
plugin: Changes port argument type on mk_socket_server().

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
monkey: Adopts port override for multiple listen sockets.

Set port in first listen structure on configuration and removes other
listen directives when port specified on commandline.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_server: Adds multisocket support for server loop.

Adds support for multiple listening sockets when SO_REUSEADRESS is
unavailable. Uses poll() for event notification.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_epoll: Adds multisocket support to epoll loop.

Changes arguments of mk_epoll_init() to accept a mk_server_listen
struct instead of a filedescriptor.
Adds code to register listening sockets from mk_server_listen to
epoll().
Adds call to mk_server_listen_handler() when a new connection arrives.
Changes type of mk_api->epoll_init().

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_scheduler: Adds mk_sched_next_target().

Used in mk_server to balance new connections.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_scheduler: Removes mk_scheduler_add_client*() methods.

mk_scheduler_add_client_reuseport() and mk_scheduler_add_client() are
superseded by mk_server_listen_handler().

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_scheduler: Initialize mk_server_listen struct.

Binds listening sockets when thread is launched.
Use stack-allocated mk_server_listen to start mk_epoll_loop().

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
plugins/cheetah: Fixes printing of listen addresses.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
plugins/logger: Fixes printing of listen addresses.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_lib: Fixes errors from changes made to server_config.

Use config->listen.address and config->listen.port instead of
config->listen_addr and config->serverport.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
mk_lib: Adds multi listening socket support.
API: export je_mallctl when JEMALLOC_STATS is set

Signed-off-by: Eduardo Silva <eduardo@monkey.io>

Conflicts:
	include/monkey/mk_plugin.h
Header: when using Chunked encoding, do not set Content-Length

Signed-off-by: Eduardo Silva <eduardo@monkey.io>
Merge pull request #168 from ksonny/master

Multiple listen sockets support
README: updates

Signed-off-by: Eduardo Silva <eduardo@monkey.io>
Core: fix API usage on new Listeners mode and small changes

A new feature for multiple listeners was added but it did not follow
the Monkey pattern internals, this patch perform the following changes:

 - Listeners are not longer a linked list, instead a mk_list.
 - Memory allocations/deallocations now use mk_mem_*() family.
 - Renamed concepts of 'listen' to 'listener' and 'listeners'.
 - Small function to register a new listener.

Signed-off-by: Eduardo Silva <eduardo@monkey.io>
Lib: fix API for new Listener stuff

Signed-off-by: Eduardo Silva <eduardo@monkey.io>