Useless check or Waste of time
In file https://github.com/ValvePython/steam/blob/0a6d152e514f0f0cfd8f8e17a8d86341e85aff23/steam/client/init.py#L484
in method called login on line 569 we can see a useless check:
if resp and resp.body.eresult == EResult.OK:
self.sleep(0.5)
this is useless because it is followed by a return string of this method:
return EResult(resp.body.eresult) if resp else EResult.Fail
And why we spend exactly 0.5 seconds, why, for example, not 0.25 or even 1 second?
That is hack to allow a couple of async events to run before the functions returns. Could potentially be improved
@rossengeorgiev Can you give an example of when this hack starts to work? My primitive tests show that this line can be safely removed.
According to the origin commit 9ef8e5d9521f19188f80630087ece3738df2f63f it is to allow the client to be considered fully connected (on the backend i guess). I was getting disconnected when I tried to send message immediately after login() returned.