From ff8c04a6e987fe7534dc5d87103583eb890bee45 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 26 Aug 2020 16:12:10 -0400 Subject: [PATCH] chore: Change client parsing from error to log --- runtime/include/runtime.h | 3 +++ runtime/src/sandbox.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/include/runtime.h b/runtime/include/runtime.h index 2a529fe..d086a9e 100644 --- a/runtime/include/runtime.h +++ b/runtime/include/runtime.h @@ -15,6 +15,9 @@ #define RUNTIME_READ_WRITE_VECTOR_LENGTH 16 #define RUNTIME_GRANULARITY 100000 +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + /* * Descriptor of the epoll instance used to monitor the socket descriptors of registered * serverless modules. The listener cores listens for incoming client requests through this. diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 3bbcdc0..7b837aa 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -62,7 +62,9 @@ sandbox_parse_http_request(struct sandbox *sandbox, size_t length) if (length == 0) return 0; /* Assumption: We shouldn't have anything left to parse if message was successfully parsed to completion */ - assert(!sandbox->http_request.message_end); + if (unlikely(sandbox->http_request.message_end)) { + debuglog("Unexpectedly received client data after message was parsed to completion"); + }; size_t length_parsed = http_parser_execute(&sandbox->http_parser, http_parser_settings_get(), sandbox->request_response_data