Thanks - That looks like an issue with the SIM900 code then. The idea is that the send and recv functions in the JS code return a non-string value to signify an error (usually -1).
You've made your own tweaked module haven't you? I think in the CIPSTART case, literally just removing the line throw new Error('CIPSTART failed.') will fix it - as then the socket data gets set to undefined, and next time Espruino tries to read or send data, the error will get reported back and the socket will get closed with everything freed.
You could also look at where the handler for CONNECT OK is and add your own connect fail handler:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks - That looks like an issue with the SIM900 code then. The idea is that the
send
andrecv
functions in the JS code return a non-string value to signify an error (usually-1
).You've made your own tweaked module haven't you? I think in the CIPSTART case, literally just removing the line
throw new Error('CIPSTART failed.')
will fix it - as then the socket data gets set to undefined, and next time Espruino tries to read or send data, the error will get reported back and the socket will get closed with everything freed.You could also look at where the handler for
CONNECT OK
is and add your own connect fail handler: