示例#1
0
static int  do_listen_interrupt()
{
	console_printf("BUG: How on earth to properly stop listening???\n");
	espconn_disconnect(&esp_conn);
	
	void *p; 
	bool value = espconn_find_connection(&esp_conn, &p);
	console_printf("===>%d \n", value);
	espconn_tcp_disconnect(p);

//	os_free(linebuffer);
	console_lock(0);
}
示例#2
0
/******************************************************************************
 * FunctionName : espconn_disconnect
 * Description  : disconnect with host
 * Parameters   : espconn -- the espconn used to disconnect the connection
 * Returns      : none
*******************************************************************************/
sint8 ICACHE_FLASH_ATTR
espconn_disconnect(struct espconn *espconn)
{
	espconn_msg *pnode = NULL;
	bool value = false;

    if (espconn == NULL) {
        return ESPCONN_ARG;;
    } else if (espconn ->type != ESPCONN_TCP)
    	return ESPCONN_ARG;

    value = espconn_find_connection(espconn, &pnode);

    if (value){
    	espconn_tcp_disconnect(pnode);
    	return ESPCONN_OK;
    } else
    	return ESPCONN_ARG;
}
示例#3
0
/******************************************************************************
 * FunctionName : espconn_abort
 * Description  : Forcely abort with host
 * Parameters   : espconn -- the espconn used to disconnect the connection
 * Returns      : none
*******************************************************************************/
sint8 ICACHE_FLASH_ATTR
espconn_abort(struct espconn *espconn)
{
	espconn_msg *pnode = NULL;
	bool value = false;

    if (espconn == NULL) {
        return ESPCONN_ARG;;
    } else if (espconn ->type != ESPCONN_TCP)
    	return ESPCONN_ARG;

    /*Find the node depend on the espconn message*/
    value = espconn_find_connection(espconn, &pnode);

    if (value){
    	/*protect for redisconnection*/
    	if (espconn->state == ESPCONN_CLOSE)
    		return ESPCONN_INPROGRESS;
    	espconn_tcp_disconnect(pnode,1);	//1 force, 0 normal
    	return ESPCONN_OK;
    } else
    	return ESPCONN_ARG;
}