Skip to content

Commit

Permalink
- fix bug: click on red close box in top-right corner would not quit …
Browse files Browse the repository at this point in the history
…the server

- fix bug: don't print '304' HTTP errors in the log pane: it only scares users and it just means that Mongoose reported the file as 'Not Modified' which is perfectly legal.
  • Loading branch information
GerHobbelt committed Apr 17, 2013
1 parent 85808f6 commit 1380a82
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion examples/book_samples_server.c
Expand Up @@ -547,7 +547,17 @@ static void *mongoose_callback(enum mg_event event, struct mg_connection *conn)
if (event == MG_EVENT_LOG)
{
DEBUG_TRACE(0x00010000, ("[%s] %s", request_info->log_severity, request_info->log_message));
append_log("[%s] %s\n", request_info->log_severity, request_info->log_message);
// we do not log 'HTTP RESPONSE 304' 'error' lines as those are very valid responses (304 = Not Modified) which should not pollute the log window.
switch (request_info->status_code)
{
case 304:
// do not log 'Not Modified' messages.
break;

default:
append_log("[%s] %s\n", request_info->log_severity, request_info->log_message);
break;
}
return (void *)1;
}

Expand Down Expand Up @@ -1208,6 +1218,7 @@ static BOOL CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_COMMAND:
switch (LOWORD(wParam)) {
case ID_QUIT:
should_restart = 0;
mg_stop(ctx);
ctx = NULL;
//Shell_NotifyIconA(NIM_DELETE, &TrayIcon);
Expand Down Expand Up @@ -1289,9 +1300,16 @@ static BOOL CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam,
ctx = NULL;
//Shell_NotifyIconA(NIM_DELETE, &TrayIcon);
PostQuitMessage(EXIT_SUCCESS);

DragAcceptFiles(hWnd, FALSE);
DestroyWindow(hWnd);

return TRUE; // We've just sent our own quit message, with proper hwnd.

case WM_DESTROY:
if (hWnd == app_hwnd) {
app_hwnd = NULL;
}
break;

case WM_NCDESTROY:
Expand Down
1 change: 1 addition & 0 deletions mongoose.c
Expand Up @@ -2780,6 +2780,7 @@ static unsigned int __stdcall __pthread_starter_func(void *arg) {
o = NULL;
l = __pthread_list;
while (l && l->thread_id != id) {
o = l;
l = l->next;
}
if (o && l) {
Expand Down

0 comments on commit 1380a82

Please sign in to comment.