Mercurial > hg > openttd
changeset 14250:14e494dae1a7 draft
(svn r18801) -Fix: in some cases error messages weren't properly sent to the client before closing the connection. As a result the client would say 'connection lost' when the cause was something completely different.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 14 Jan 2010 21:48:42 +0000 |
parents | ac766fc12c2a |
children | 8f07fd792c75 |
files | src/network/core/tcp.cpp src/network/core/tcp.h src/network/network.cpp |
diffstat | 3 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -81,8 +81,9 @@ * 2) the OS reports back that it can not send any more * data right now (full network-buffer, it happens ;)) * 3) sending took too long + * @param closing_down Whether we are closing down the connection. */ -bool NetworkTCPSocketHandler::Send_Packets() +bool NetworkTCPSocketHandler::Send_Packets(bool closing_down) { ssize_t res; Packet *p; @@ -98,15 +99,17 @@ int err = GET_LAST_ERROR(); if (err != EWOULDBLOCK) { /* Something went wrong.. close client! */ - DEBUG(net, 0, "send failed with error %d", err); - this->CloseConnection(); + if (!closing_down) { + DEBUG(net, 0, "send failed with error %d", err); + this->CloseConnection(); + } return false; } return true; } if (res == 0) { /* Client/server has left us :( */ - this->CloseConnection(); + if (!closing_down) this->CloseConnection(); return false; }