diff --git a/components/esp8266/include/esp_socket.h b/components/esp8266/include/esp_socket.h index 4ebc6971..5b5ee1f4 100644 --- a/components/esp8266/include/esp_socket.h +++ b/components/esp8266/include/esp_socket.h @@ -137,6 +137,36 @@ typedef struct esp_socket_method { int (*close)(void *index); } esp_socket_method_t; +/* + * @brief free an aio control block by calling the callback function + * + * @param aio asynchronous I/O controlling block + * @param aio data handling result + * + * @return none + */ +static inline void esp_aio_free(esp_aio_t *aio, int status) +{ + if (aio->cb) { + aio->ret = status; + aio->cb(aio); + } +} + +/* + * @brief drop an aio control block by disable "pbuf" and "cb" + * and then the aio control block has no meaning + * + * @param aio asynchronous I/O controlling block + * + * @return none + */ +static inline void esp_aio_drop(esp_aio_t *aio) +{ + aio->pbuf = NULL; + aio->cb = NULL; +} + /* * @brief create a socket file description * diff --git a/components/esp8266/source/esp_socket.c b/components/esp8266/source/esp_socket.c index 6c025be0..74d2def5 100644 --- a/components/esp8266/source/esp_socket.c +++ b/components/esp8266/source/esp_socket.c @@ -25,7 +25,7 @@ #define CRITICAL_EXIT(t) #ifndef ESP_SOCKET_MAX -#define ESP_SOCKET_MAX 3 +#define ESP_SOCKET_MAX 2 #endif #define SET_ERR(err) errno = err