Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

TCPAsyncSocketConnection bugfix #149

Closed MeRuslan closed 3 years ago

MeRuslan commented 3 years ago

TCPAsyncSocketConnection uses asyncio.wait_for wrapper only when connecting. Now it uses it for reading as well, as per usual, test included.

MeRuslan commented 3 years ago

If you feed a server that allows connecting, but does not respond, it would simply hang on forever in server.async_status(). This PR fixes that.

MeRuslan commented 3 years ago

PS it breaks one of the existing tests, but I'm not sure why exactly. Cause nothing really changes.

Frankly, I think that test does not works as intended, even without my changes. I.e. without my changes the exception is raised nonetheless raise IOError("Received invalid ping response packet."), ping is successful only the second time it's called, which is a test bug it seems.

kevinkjt2000 commented 3 years ago

I found the cause was related to closing the client connection early in that test that was failing. I've fixed that and python 3.6 compatibilities, so I'm about to release v6.3.0 which includes this.