mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Fix #1888: add %I *printf specifier for IP address. Remove mg_ntoa, mg_straddr
This commit is contained in:
1 parent
89fb3a3d6e
commit
b01989f041
12 files changed
+105
-144
No files matched your search
@@ -24,14 +24,12 @@ static void wcb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
mg_printf(c, "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n");
|
||||
mg_http_printf_chunk(c, "ID PROTO TYPE LOCAL REMOTE\n");
|
||||
for (struct mg_connection *t = c->mgr->conns; t != NULL; t = t->next) {
|
||||
char loc[40], rem[40];
|
||||
mg_http_printf_chunk(c, "%-3lu %4s %s %-15s %s\n", t->id,
|
||||
mg_http_printf_chunk(c, "%-3lu %4s %s %I %I\n", t->id,
|
||||
t->is_udp ? "UDP" : "TCP",
|
||||
t->is_listening ? "LISTENING"
|
||||
: t->is_accepted ? "ACCEPTED "
|
||||
: "CONNECTED",
|
||||
mg_straddr(&t->loc, loc, sizeof(loc)),
|
||||
mg_straddr(&t->rem, rem, sizeof(rem)));
|
||||
4, &t->loc.ip, 4, &t->rem.ip);
|
||||
}
|
||||
mg_http_printf_chunk(c, ""); // Don't forget the last empty chunk
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user