Fixed missing completion call issue. However, boost::asio now automatically closes the socket. This cannot be disabled. So the next step is to use the boost::asio socket class for the session and everywhere else.
This commit is contained in:
@@ -26,10 +26,10 @@
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
using namespace std;
|
||||
using boost::asio::ip::tcp;
|
||||
using boost::asio::ip::tcp;
|
||||
|
||||
|
||||
#define SEND_ERROR_TIMEOUT_MSEC 20000
|
||||
@@ -46,7 +46,6 @@ SenderThread::SendDataManager::HandleWrite(const boost::system::error_code& erro
|
||||
SetCompleted(true);
|
||||
}
|
||||
|
||||
|
||||
SenderThread::SenderThread(SenderCallback &cb)
|
||||
: m_callback(cb)
|
||||
{
|
||||
@@ -135,18 +134,19 @@ SenderThread::Main()
|
||||
else
|
||||
{
|
||||
boost::shared_ptr<NetPacket> tmpPacket = tmpManager->list.front();
|
||||
boost::asio::async_write(
|
||||
*tmpManager->socket,
|
||||
boost::asio::buffer(tmpPacket->GetRawData(),
|
||||
tmpPacket->GetLen()),
|
||||
boost::bind(&SendDataManager::HandleWrite, tmpManager,
|
||||
boost::asio::placeholders::error));
|
||||
tmpManager->SetWriteInProgress(true);
|
||||
boost::asio::async_write(
|
||||
*tmpManager->socket,
|
||||
boost::asio::buffer(tmpPacket->GetRawData(),
|
||||
tmpPacket->GetLen()),
|
||||
boost::bind(&SendDataManager::HandleWrite, tmpManager,
|
||||
boost::asio::placeholders::error));
|
||||
tmpManager->SetWriteInProgress(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = next;
|
||||
}
|
||||
m_ioService.run_one();
|
||||
Msleep(SEND_TIMEOUT_MSEC);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user