satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
57 stars 13 forks source link

Fix error handling of server socket connections. Closes GH-47 #135

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

https://github.com/satoshinm/NetCraft/issues/47

satoshinm commented 7 years ago

Chunks can't be rendered without chunk data from the server, but changed to now see the errors (not only the sky, which was added in https://github.com/satoshinm/NetCraft/issues/107):

screenshot-netcraft-2017-05-17t06_16_07 028z

satoshinm commented 7 years ago

Added client_disable() on socket close or error, this now covers the server disconnecting the client, no more errors. It is still theoretically possible to have the client call exit() (in client.c), if a socket call fails, but the socket functions are guarded by if (!client_enabled) so this should be less likely, and an error in e.g. send() points to a more serious problem in the web client - and exiting is acceptable in this case in the native client.