Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
471 stars 175 forks source link

Cant call close multiple times #141

Closed jbockerstette closed 7 years ago

jbockerstette commented 7 years ago

If I call close more than once, it throws TypeError. I personally think it would be better to allow you to call close multiple times on the same modbus client without throwing the TypeError. This is not a show stopper for me at all. Your code is great!

stefanpoeter commented 7 years ago

Thanks for the hint. I'll make an update.

stefanpoeter commented 7 years ago

Can you confirm that pull request #142 fixes this?

jbockerstette commented 7 years ago

I verified that now I can call close multiple times without throwing a TypeError. What was happening is that when you call close, socket.end() gets called. If you call it again, then socket.end() would get called again but on the second call, socket === null and then it would throw. So yes, this is fixed.

Thanks.