cwalter-at / freemodbus

BSD licensed MODBUS RTU/ASCII and TCP slave
768 stars 393 forks source link

Fixed bug related to lwIP TCP socket errors. When the lwIP Raw API #13

Open jdscott-infinetix opened 4 years ago

jdscott-infinetix commented 4 years ago

invokes the registerd 'tcp_err' handler, the socket is not provided for a reason. After the error handler returns, lwIP frees the TCP PCB object. If the error handler has already freed the TCP PCB in the error handler, the TCP PCB pool within lwIP is tainted and the lwIP stack will get stuck in an infinite loop.