handle single threading
[openocd.git] / src / server / httpd.c
index 4705e4426c0c17aa4711de79fd37af41d1b3dd7a..0ddeb97acc67b9cd7cd9718196be5c633bc0439e 100644 (file)
 
 #define PAGE_NOT_FOUND "<html><head><title > File not found</title></head><body > File not found</body></html>"
 
+static pthread_mutex_t mutex;
+
+void openocd_sleep_prelude(void)
+{
+       pthread_mutex_unlock(&mutex);
+}
+
+void openocd_sleep_postlude(void)
+{
+       pthread_mutex_lock(&mutex);
+}
+
+
+
 int loadFile(const char *name, void **data, size_t *len);
 
 static const char *appendf(const char *prev, const char *format, ...)
@@ -184,7 +198,9 @@ static void request_completed(void *cls, struct MHD_Connection *connection,
 
        if (r->postprocessor)
        {
+               openocd_sleep_postlude();
                MHD_destroy_post_processor(r->postprocessor);
+               openocd_sleep_prelude();
        }
 
        free(r);
@@ -257,7 +273,7 @@ static int record_arg(void *cls, enum MHD_ValueKind kind, const char *key,
 }
 
 
-int handle_request(struct MHD_Connection * connection, const char * url)
+static int handle_request(struct MHD_Connection * connection, const char * url)
 {
        struct MHD_Response * response;
 
@@ -335,7 +351,7 @@ int handle_request(struct MHD_Connection * connection, const char * url)
        }
 }
 
-static int ahc_echo(void * cls, struct MHD_Connection * connection,
+static int ahc_echo_inner(void * cls, struct MHD_Connection * connection,
                const char * url, const char * method, const char * version,
                const char * upload_data, unsigned int * upload_data_size, void ** ptr)
 {
@@ -423,9 +439,23 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection,
        return result;
 }
 
-static struct MHD_Daemon * d;
-static pthread_mutex_t mutex;
 
+static int ahc_echo(void * cls, struct MHD_Connection * connection,
+               const char * url, const char * method, const char * version,
+               const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+{
+       int result;
+
+       openocd_sleep_postlude();
+
+       result = ahc_echo_inner(cls, connection, url, method, version, upload_data, upload_data_size, ptr);
+
+       openocd_sleep_prelude();
+
+       return result;
+}
+
+static struct MHD_Daemon * d;
 
 int httpd_start(void)
 {
@@ -464,13 +494,3 @@ void httpd_stop(void)
        pthread_mutex_destroy(&mutex);
 }
 
-void openocd_sleep_prelude(void)
-{
-       pthread_mutex_unlock(&mutex);
-}
-
-void openocd_sleep_postlude(void)
-{
-       pthread_mutex_lock(&mutex);
-}
-

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)