Trying to fix strange sender crash.

This commit is contained in:
lotodore
2009-06-20 11:15:06 +00:00
parent 34b251bfad
commit 470bbb5eed
+6 -5
View File
@@ -17,16 +17,17 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <net/socket_helper.h> #include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>\
#include <net/senderhelper.h> #include <net/senderhelper.h>
#include <net/sendercallback.h> #include <net/sendercallback.h>
#include <net/socket_helper.h>
#include <net/socket_msg.h> #include <net/socket_msg.h>
#include <core/loghelper.h> #include <core/loghelper.h>
#include <cstring> #include <cstring>
#include <cassert> #include <cassert>
#include <boost/bind.hpp>
using namespace std; using namespace std;
using boost::asio::ip::tcp; using boost::asio::ip::tcp;
@@ -39,7 +40,7 @@ using boost::asio::ip::tcp;
typedef std::list<boost::shared_ptr<NetPacket> > SendDataList; typedef std::list<boost::shared_ptr<NetPacket> > SendDataList;
class SendDataManager class SendDataManager : public boost::enable_shared_from_this<SendDataManager>
{ {
public: public:
SendDataManager() SendDataManager()
@@ -105,7 +106,7 @@ SendDataManager::AsyncSendNextPacket(boost::shared_ptr<boost::asio::ip::tcp::soc
*socket, *socket,
boost::asio::buffer(sendBuf, bufSize), boost::asio::buffer(sendBuf, bufSize),
boost::bind(&SendDataManager::HandleWrite, boost::bind(&SendDataManager::HandleWrite,
this, shared_from_this(),
socket, socket,
boost::asio::placeholders::error)); boost::asio::placeholders::error));
writeInProgress = true; writeInProgress = true;