marceldev89 / BattleNET

BattlEye Protocol Library and Client
GNU Lesser General Public License v3.0
76 stars 44 forks source link

Unhandled exception #21

Closed Phazeshift closed 11 years ago

Phazeshift commented 11 years ago

I've found that BattlEyeClient will occasionally throw an unhandled ObjectDisposedException in the Receive method, caused by accessing socket.Available when the socket has been disconnected.

I think this happens when the timeoutServer value causes Disconnect to be called, which closes the socket and the receive thread then continues and calls socket.Available. I fixed it by adding another check of Socket.Connected:

if (socket.Connected && packetQueue.Count > 0 && socket.Available == 0)

marceldev89 commented 11 years ago

Thanks, missed that one. :)

Paronity commented 11 years ago

Was just coming to post this one as I just ran into it consistently on my new server when it's at capacity. Same fix on my end took care of it.