diff options
| author | Remko Tronçon <git@el-tramo.be> | 2010-06-18 21:17:26 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2010-06-18 21:27:59 (GMT) | 
| commit | 154bf14ac15fc7bff918c20814b29b5cc3bc5ba4 (patch) | |
| tree | 28f18493bb6bc1cbf85b90f391daa6c4e1ecb3aa /Swiften/Network/BoostConnection.h | |
| parent | b763087e13f25e08aa51a6568b03727f136de34e (diff) | |
| download | swift-contrib-154bf14ac15fc7bff918c20814b29b5cc3bc5ba4.zip swift-contrib-154bf14ac15fc7bff918c20814b29b5cc3bc5ba4.tar.bz2 | |
Fix crash on reconnect.
BoostTimer isn't supposed to be constructed as a non-shared-ptr. Making
constructor private to avoid this error in the future.
Diffstat (limited to 'Swiften/Network/BoostConnection.h')
| -rw-r--r-- | Swiften/Network/BoostConnection.h | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h index abe7eeb..8d3d444 100644 --- a/Swiften/Network/BoostConnection.h +++ b/Swiften/Network/BoostConnection.h @@ -22,9 +22,14 @@ namespace boost {  namespace Swift {  	class BoostConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<BoostConnection> {  		public: -			BoostConnection(boost::asio::io_service* ioService); +			typedef boost::shared_ptr<BoostConnection> ref; +  			~BoostConnection(); +			static ref create(boost::asio::io_service* ioService) { +				return ref(new BoostConnection(ioService)); +			} +  			virtual void listen();  			virtual void connect(const HostAddressPort& address);  			virtual void disconnect(); @@ -35,6 +40,8 @@ namespace Swift {  			}  		private: +			BoostConnection(boost::asio::io_service* ioService); +  			void handleConnectFinished(const boost::system::error_code& error);  			void handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred);  			void handleDataWritten(const boost::system::error_code& error); | 
 Swift
 Swift