Ejemplo n.º 1
0
int32_t  Process(socket_t s)
{	
	acquire_socket_wrapper((SOCK)s);
	_recv(s);
	_send(s);
    int32_t read_active = s->readable && !LLIST_IS_EMPTY(&s->pending_recv);
    int32_t write_active = s->writeable && !LLIST_IS_EMPTY(&s->pending_send);
	release_socket_wrapper((SOCK)s);
	return (read_active || write_active);
}
Ejemplo n.º 2
0
int32_t CloseSocket(SOCK sock)
{
	struct socket_wrapper *sw = get_socket_wrapper(sock);
    if(sw){ 
		if(sw->engine) sw->engine->UnRegister(sw->engine,sw);
		close(sw->fd);
		release_socket_wrapper(sock);
		return 0;
	}
	return -1;
}