add user_data in esl_listen so the main function can pass a private user_data to callback

This commit is contained in:
Seven Du
2014-02-16 08:14:44 +08:00
parent 01e3eb458e
commit 11dee76381
5 changed files with 17 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <esl.h>
static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr)
static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr, void *user_data)
{
esl_handle_t handle = {{0}};
int done = 0;
@@ -66,7 +66,7 @@ int main(void)
signal(SIGCHLD, SIG_IGN);
esl_global_set_default_logger(7);
esl_listen("localhost", 8040, mycallback, &server_sock);
esl_listen("localhost", 8040, mycallback, NULL, &server_sock);
return 0;
}