mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-16 10:29:22 +08:00
22 lines
563 B
C
22 lines
563 B
C
#include "event.h"
|
|
#include "log.h"
|
|
#include "net.h"
|
|
#include "util.h"
|
|
|
|
void mg_call(struct mg_connection *c, int ev, void *ev_data) {
|
|
if (c->pfn != NULL) c->pfn(c, ev, ev_data, c->pfn_data);
|
|
if (c->fn != NULL) c->fn(c, ev, ev_data, c->fn_data);
|
|
}
|
|
|
|
void mg_error(struct mg_connection *c, const char *fmt, ...) {
|
|
char mem[256], *buf = mem;
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
mg_vasprintf(&buf, sizeof(mem), fmt, ap);
|
|
va_end(ap);
|
|
LOG(LL_ERROR, ("%lu %s", c->id, buf));
|
|
mg_call(c, MG_EV_ERROR, buf);
|
|
if (buf != mem) free(buf);
|
|
c->is_closing = 1;
|
|
}
|