uh_connection: remove api: free

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
main
Jianhui Zhao 2020-09-08 22:45:21 +08:00
parent 15c2b53bcb
commit b77d83c60b
3 changed files with 4 additions and 4 deletions

View File

@ -373,7 +373,7 @@ static struct http_parser_settings settings = {
.on_message_complete = on_message_complete_cb .on_message_complete = on_message_complete_cb
}; };
static void conn_free(struct uh_connection *conn) void conn_free(struct uh_connection *conn)
{ {
struct ev_loop *loop = conn->srv->loop; struct ev_loop *loop = conn->srv->loop;
struct sockaddr_in *addr = &conn->addr; struct sockaddr_in *addr = &conn->addr;
@ -589,7 +589,6 @@ struct uh_connection *uh_new_connection(struct uh_server *srv, int sock, struct
conn->parser.data = conn; conn->parser.data = conn;
conn->free = conn_free;
conn->done = conn_done; conn->done = conn_done;
conn->send = conn_send; conn->send = conn_send;
conn->send_file = conn_send_file; conn->send_file = conn_send_file;

View File

@ -94,7 +94,6 @@ struct uh_connection {
struct http_parser_url url_parser; struct http_parser_url url_parser;
struct uh_connection *prev; struct uh_connection *prev;
struct uh_connection *next; struct uh_connection *next;
void (*free)(struct uh_connection *conn);
void (*done)(struct uh_connection *conn); /* Must be called at last, if not call 'error', 'redirect' and 'serve_file' */ void (*done)(struct uh_connection *conn); /* Must be called at last, if not call 'error', 'redirect' and 'serve_file' */
void (*send)(struct uh_connection *conn, const void *data, ssize_t len); void (*send)(struct uh_connection *conn, const void *data, ssize_t len);
void (*send_file)(struct uh_connection *conn, const char *path); void (*send_file)(struct uh_connection *conn, const char *path);

View File

@ -37,6 +37,8 @@
#include "ssl.h" #include "ssl.h"
#include "log.h" #include "log.h"
void conn_free(struct uh_connection *conn);
static void uh_server_free(struct uh_server *srv) static void uh_server_free(struct uh_server *srv)
{ {
struct uh_connection *conn = srv->conns; struct uh_connection *conn = srv->conns;
@ -48,7 +50,7 @@ static void uh_server_free(struct uh_server *srv)
while (conn) { while (conn) {
struct uh_connection *next = conn->next; struct uh_connection *next = conn->next;
conn->free(conn); conn_free(conn);
conn = next; conn = next;
} }