I have the logic:
init() {
....
rc = espconn_set_opt (conn, ESPCONN_COPY); // enable write buffer
...
}
espbuffsent (serverConnData *conn, const char *data, uint16 len) {
...
if (conn->readytosend)
{
LOG('S');LOG(0);
rc = sendtxbuffer (conn);
}
else
{
LOG('N');
}
}
sendtxbuffer (serverConnData *conn)
{
if (conn->txbufferlen != 0)
{
conn->readytosend = false;
result = espconn_send (conn->conn, (uint8_t*) conn->txbuffer, conn->txbufferlen);
if (result == ESPCONN_OK)
{
conn->txbufferlen = 0;
}
}
user_tcp_write_finish (void *arg)
{
LOG('F');
serverConnData *conn = serverFindConnData (arg);
conn->readytosend = true;
LOG('s');
if (conn->txbufferlen > 0)
{
sendtxbuffer (conn); // send possible new data in txbuffer
}
}
It works for some Frames, but then I get a Error
ESPCONN_MAXNUM from espconn_send(...)
There is no user_tcp_write_finish or serversendcb anymore ....
Then the logic freezes. How can I debug the error, or get out of the hold?
Is something wrong with the code?
I tested also to reset conn->readytosend in serversendcb.
esp_iot_sdk_v1.4.0
ai-thinker ESP8266MOD