summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/mongoose/README.chromium7
-rw-r--r--third_party/mongoose/mongoose.c10
2 files changed, 12 insertions, 5 deletions
diff --git a/third_party/mongoose/README.chromium b/third_party/mongoose/README.chromium
index 56532b4..e2db77b 100644
--- a/third_party/mongoose/README.chromium
+++ b/third_party/mongoose/README.chromium
@@ -1,7 +1,9 @@
-Name: mongoose
+Name: Mongoose webserver
+Short Name: mongoose
URL: http://code.google.com/p/mongoose/
LICENSE: MIT
Version: 2.8
+Security Critical: no
Description:
Mongoose is an easy to use web server. It can be embedded into existing
@@ -28,4 +30,5 @@ the chrome versoin of webdriver found under the directory:
Local modifications:
-Do not check for OS_POSIX, instead just check that it is not windows.
-
+-Handle case where pthread_cond_timedwait times out but the condition predicate
+is actually true.
diff --git a/third_party/mongoose/mongoose.c b/third_party/mongoose/mongoose.c
index 24874e5..26e4077 100644
--- a/third_party/mongoose/mongoose.c
+++ b/third_party/mongoose/mongoose.c
@@ -4486,9 +4486,13 @@ get_socket(struct mg_context *ctx, struct socket *sp)
#endif
if (pthread_cond_timedwait(&ctx->empty_cond,
&ctx->thr_mutex, &ts) != 0) {
- /* Timeout! release the mutex and return */
- (void) pthread_mutex_unlock(&ctx->thr_mutex);
- return (FALSE);
+ // Even if the wait timed out, it is not guaranteed that the condition
+ // predicate is actually false.
+ if (ctx->sq_head == ctx->sq_tail) {
+ /* Timeout! release the mutex and return */
+ (void) pthread_mutex_unlock(&ctx->thr_mutex);
+ return (FALSE);
+ }
}
}
assert(ctx->sq_head > ctx->sq_tail);