diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-20 11:47:41 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-20 11:47:41 +0100 |
commit | 13678bed5f6c64e8e108dcc4ab6a9f94fee11401 (patch) | |
tree | 2c564dd9c1cb8e1b64fbf60650ecaddeb04e5353 | |
parent | c0864168aa88ca21c09a45b5ea13352262f99bc4 (diff) | |
download | rspamd-13678bed5f6c64e8e108dcc4ab6a9f94fee11401.tar.gz rspamd-13678bed5f6c64e8e108dcc4ab6a9f94fee11401.zip |
Fix benchmarking server
-rw-r--r-- | utils/CMakeLists.txt | 9 | ||||
-rw-r--r-- | utils/rspamd_http_server.c | 14 |
2 files changed, 14 insertions, 9 deletions
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 9da564a32..f9eefb4f0 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,15 +4,14 @@ SET(UTILBENCHSRC rspamd_http_bench.c) ADD_EXECUTABLE(rspamd-http-server ${UTILSERVERSRC}) SET_TARGET_PROPERTIES(rspamd-http-server PROPERTIES LINKER_LANGUAGE C) TARGET_LINK_LIBRARIES(rspamd-http-server rspamd-server) - TARGET_LINK_LIBRARIES(rspamd-http-server rspamd-http-parser) TARGET_LINK_LIBRARIES(rspamd-http-server ${RSPAMD_REQUIRED_LIBRARIES}) ADD_EXECUTABLE(rspamd-http-bench ${UTILBENCHSRC}) -SET_TARGET_PROPERTIES(rspamd-http-server PROPERTIES LINKER_LANGUAGE C) -TARGET_LINK_LIBRARIES(rspamd-http-server rspamd-server) -TARGET_LINK_LIBRARIES(rspamd-http-server rspamd-http-parser) -TARGET_LINK_LIBRARIES(rspamd-http-server ${RSPAMD_REQUIRED_LIBRARIES}) +SET_TARGET_PROPERTIES(rspamd-http-bench PROPERTIES LINKER_LANGUAGE C) +TARGET_LINK_LIBRARIES(rspamd-http-bench rspamd-server) +TARGET_LINK_LIBRARIES(rspamd-http-bench rspamd-http-parser) +TARGET_LINK_LIBRARIES(rspamd-http-bench ${RSPAMD_REQUIRED_LIBRARIES}) # Redirector IF (ENABLE_REDIRECTOR MATCHES "ON") diff --git a/utils/rspamd_http_server.c b/utils/rspamd_http_server.c index eb6b8fcba..c5cb16a24 100644 --- a/utils/rspamd_http_server.c +++ b/utils/rspamd_http_server.c @@ -43,7 +43,7 @@ static GHashTable *maps = NULL; static struct rspamd_keypair_cache *c; static gpointer server_key; static struct timeval io_tv = { - .tv_sec = 5, + .tv_sec = 20, .tv_usec = 0 }; @@ -71,8 +71,12 @@ static void rspamd_server_error (struct rspamd_http_connection *conn, GError *err) { - msg_err ("http error occurred: %s", err->message); - g_assert (0); + struct rspamd_http_server_session *session = conn->ud; + + rspamd_fprintf (stderr, "http error occurred: %s\n", err->message); + rspamd_http_connection_unref (conn); + close (session->fd); + g_slice_free1 (sizeof (*session), session); } static int @@ -102,6 +106,7 @@ rspamd_server_finish (struct rspamd_http_connection *conn, reply->code = 200; reply->status = rspamd_fstring_new_init ("OK", 2); reply->body = rspamd_fstring_sized_new (size); + reply->body->len = size; memset (reply->body->str, 0, size); } else { @@ -134,7 +139,7 @@ rspamd_server_accept (gint fd, short what, void *arg) if ((nfd = rspamd_accept_from_socket (fd, &addr)) == -1) { - msg_warn ("accept failed: %s", strerror (errno)); + rspamd_fprintf (stderr, "accept failed: %s", strerror (errno)); return; } /* Check for EAGAIN */ @@ -222,6 +227,7 @@ rspamd_http_server_term (int fd, short what, void *arg) pid_t *sfd = arg; rspamd_http_stop_servers (sfd); + event_loopexit (NULL); } int |