From c86f341d29cf983a47d9c9da6f12c3ac93253dc3 Mon Sep 17 00:00:00 2001 From: "roberto@maverick64" Date: Fri, 22 Apr 2011 09:34:50 +0200 Subject: [PATCH] first part of --socket-protocol option --- plugins/python/pyloader.c | 2 ++ uwsgi.c | 4 ++++ uwsgi.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/plugins/python/pyloader.c b/plugins/python/pyloader.c index 338541e1..ce927c35 100644 --- a/plugins/python/pyloader.c +++ b/plugins/python/pyloader.c @@ -4,6 +4,8 @@ exit(1) on every malloc error: apps can be dinamically loaded so on memory problem it is better to let the master process manager respawn the worker. + + TODO dynamic loading on prefork+thread looks flaky... NEED TO FIX IT */ extern struct uwsgi_server uwsgi; diff --git a/uwsgi.c b/uwsgi.c index 8ff7e5ee..f18bb90f 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -34,6 +34,7 @@ static char *base_short_options = "s:p:t:x:d:l:v:b:mcaCTiMhrR:z:A:Q:Ly:"; UWSGI_DECLARE_EMBEDDED_PLUGINS static struct option long_base_options[] = { {"socket", required_argument, 0, 's'}, {"protocol", required_argument, 0, LONG_ARGS_PROTOCOL}, + {"socket-protocol", required_argument, 0, LONG_ARGS_SOCKET_PROTOCOL}, {"shared-socket", required_argument, 0, LONG_ARGS_SHARED_SOCKET}, {"processes", required_argument, 0, 'p'}, {"workers", required_argument, 0, 'p'}, @@ -2505,6 +2506,9 @@ static int manage_base_opt(int i, char *optarg) { uwsgi.ini = optarg; return 1; #endif + case LONG_ARGS_SOCKET_PROTOCOL: + // TODO map each socket to a specific protocol + return 1; case LONG_ARGS_MAP_SOCKET: p = strchr(optarg, ':'); if (!p) { diff --git a/uwsgi.h b/uwsgi.h index 4a99cf75..f9c1acf4 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -421,6 +421,7 @@ struct uwsgi_opt { #define LONG_ARGS_ZEROMQ 17100 #define LONG_ARGS_INHERIT 17101 #define LONG_ARGS_VASSALS_INHERIT 17102 +#define LONG_ARGS_SOCKET_PROTOCOL 17103 #define UWSGI_OK 0 @@ -515,6 +516,8 @@ struct uwsgi_socket { int arg; void *ctx; + char *proto_name; + int (*proto)(struct wsgi_request *); int (*proto_accept)(struct wsgi_request *, int); ssize_t (*proto_write)(struct wsgi_request *, char *, size_t);