void fdevent_install(fdevent *fde, int fd, fd_func func, void *arg) { memset(fde, 0, sizeof(fdevent)); fde->state = FDE_ACTIVE; fde->fd = fd; fde->func = func; fde->arg = arg; fdevent_register(fde); dump_fde(fde, "connect"); fdevent_connect(fde); fde->state |= FDE_ACTIVE; }
void fdevent_install(fdevent *fde, int fd, fd_func func, void *arg) { memset(fde, 0, sizeof(fdevent)); fde->state = FDE_ACTIVE; fde->fd = fd; fde->func = func; fde->arg = arg; #ifndef HAVE_WINSOCK fcntl(fd, F_SETFL, O_NONBLOCK); #endif fdevent_register(fde); dump_fde(fde, "connect"); fdevent_connect(fde); fde->state |= FDE_ACTIVE; }
void fdevent_install(fdevent *fde, int fd, fd_func func, void *arg) { printf("function = %s, file = %s, line = %u, fde = %p, fd = %d, func = %p \n", __FUNCTION__, __FILE__, __LINE__, fde, fd, func); memset(fde, 0, sizeof(fdevent)); fde->state = FDE_ACTIVE; fde->fd = fd; fde->force_eof = 0; fde->func = func; fde->arg = arg; #ifndef HAVE_WINSOCK fcntl(fd, F_SETFL, O_NONBLOCK); #endif printf("function = %s, file = %s, line = %u, before fdevent_register \n", __FUNCTION__, __FILE__, __LINE__); fdevent_register(fde); dump_fde(fde, "connect"); printf("function = %s, file = %s, line = %u, after fdevent_register and before fdevent_connect \n", __FUNCTION__, __FILE__, __LINE__); fdevent_connect(fde); fde->state |= FDE_ACTIVE; }