fix critial network delay issue
This commit is contained in:
parent
4bfd335c98
commit
ada5c031d6
|
@ -155,7 +155,7 @@ void Connection::onConnect(const boost::system::error_code& error)
|
||||||
m_socket.set_option(option);
|
m_socket.set_option(option);
|
||||||
|
|
||||||
if(m_connectCallback)
|
if(m_connectCallback)
|
||||||
g_dispatcher.addEvent(m_connectCallback);
|
m_connectCallback();
|
||||||
} else
|
} else
|
||||||
handleError(error);
|
handleError(error);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ void Connection::onRecv(const boost::system::error_code& error, size_t recvSize)
|
||||||
|
|
||||||
if(!error) {
|
if(!error) {
|
||||||
if(m_recvCallback)
|
if(m_recvCallback)
|
||||||
g_dispatcher.addEvent(std::bind(m_recvCallback, m_recvBuffer, recvSize));
|
m_recvCallback(m_recvBuffer, recvSize);
|
||||||
} else
|
} else
|
||||||
handleError(error);
|
handleError(error);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ void Connection::handleError(const boost::system::error_code& error)
|
||||||
{
|
{
|
||||||
if(error != asio::error::operation_aborted) {
|
if(error != asio::error::operation_aborted) {
|
||||||
if(m_errorCallback)
|
if(m_errorCallback)
|
||||||
g_dispatcher.addEvent(std::bind(m_errorCallback, error));
|
m_errorCallback(error);
|
||||||
if(m_connected || m_connecting)
|
if(m_connected || m_connecting)
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
class Connection : public std::enable_shared_from_this<Connection>, boost::noncopyable
|
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;
|
typedef std::function<void(uint8*, uint16)> RecvCallback;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -983,7 +983,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
|
||||||
return;
|
return;
|
||||||
else {
|
else {
|
||||||
if(stackPos >= 10)
|
if(stackPos >= 10)
|
||||||
logTraceWarning("too many things");
|
logTraceError("too many things, stackpos=", stackPos, " pos=", position);
|
||||||
|
|
||||||
ThingPtr thing = internalGetThing(msg);
|
ThingPtr thing = internalGetThing(msg);
|
||||||
g_map.addThing(thing, position, 255);
|
g_map.addThing(thing, position, 255);
|
||||||
|
|
Loading…
Reference in New Issue