While contemplating this, a though struck me. If I receive an indication that a connection is now in error ... should I then subsequently issue an "espconn_disconnect" to close the connection?
My thinking here is blurry ... I have assumed that calling "espconn_disconnect" will close a connection and free up ESP8266 resources. But what if the ESP detects that a connection is now bad? Has it already freed up the resources or do I now have to explicitly state that I realize that the connection has failed and it is now ok to forget about it ... as in performing an actual "espconn_disconnect"?
To make matters even grayer, the error callback supplies an indication of the nature of the error. The options include:
ESPCONN_TIMEOUT (-3)
ESPCONN_ABRT (-8)
ESPCONN_RST (-9)
ESPCONN_CLSD (-10)
ESPCONN_CONN (-11) – Failed connecting to a partner
ESPCONN_HANDSHAKE (-28)
ESPCONN_PROTO_MSG ??
Do some of these need explicit closing of a connection? None of them? All of them?
A mystery (to me). I'd be very interested to hear your own thoughts.