fix critial network delay issue

This commit is contained in:
Eduardo Bart 2012-01-09 16:45:13 -02:00
parent 4bfd335c98
commit ada5c031d6
3 changed files with 5 additions and 5 deletions

View File

@ -155,7 +155,7 @@ void Connection::onConnect(const boost::system::error_code& error)
m_socket.set_option(option);
if(m_connectCallback)
g_dispatcher.addEvent(m_connectCallback);
m_connectCallback();
} else
handleError(error);
@ -182,7 +182,7 @@ void Connection::onRecv(const boost::system::error_code& error, size_t recvSize)
if(!error) {
if(m_recvCallback)
g_dispatcher.addEvent(std::bind(m_recvCallback, m_recvBuffer, recvSize));
m_recvCallback(m_recvBuffer, recvSize);
} else
handleError(error);
}
@ -197,7 +197,7 @@ void Connection::handleError(const boost::system::error_code& error)
{
if(error != asio::error::operation_aborted) {
if(m_errorCallback)
g_dispatcher.addEvent(std::bind(m_errorCallback, error));
m_errorCallback(error);
if(m_connected || m_connecting)
close();
}

View File

@ -28,7 +28,7 @@
class Connection : public std::enable_shared_from_this<Connection>, boost::noncopyable
{
typedef std::function<void(boost::system::error_code&)> ErrorCallback;
typedef std::function<void(const boost::system::error_code&)> ErrorCallback;
typedef std::function<void(uint8*, uint16)> RecvCallback;
enum {

View File

@ -983,7 +983,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
return;
else {
if(stackPos >= 10)
logTraceWarning("too many things");
logTraceError("too many things, stackpos=", stackPos, " pos=", position);
ThingPtr thing = internalGetThing(msg);
g_map.addThing(thing, position, 255);