Exemplo n.º 1
0
void esp8266_module::wifi_cancelation(bool all)
{
	CSocket* sock;

	//cancel open waiting
	sock = (CSocket*)waiting_open;
	while(sock)
	{
		if(sock->mode1 || all)
		{
			sock->list_remove(waiting_open);
			usr_HND_SET_STATUS(sock, RES_SIG_IDLE);
			sock = (CSocket*)waiting_open;
		} else
		{
			sock = (CSocket*)sock->next;
		}
	}

	//cancel reading sockets
	for(int sid=0; sid < WIFI_ESP8266_MAX_SOCKETS; sid++)
	{
		sock = alloc_sockets[sid];
		if (  sock && (all || sock->mode1) && ((sock->res & RES_BUSY_WAITING) == RES_BUSY_WAITING))
		{
			usr_HND_SET_STATUS(sock, (sock->res & FLG_OK)| FLG_SIGNALED);
		}

	}

}