Index: /source/ariba/utility/transport/rfcomm/rfcomm.cpp
===================================================================
--- /source/ariba/utility/transport/rfcomm/rfcomm.cpp	(revision 5423)
+++ /source/ariba/utility/transport/rfcomm/rfcomm.cpp	(revision 5424)
@@ -33,12 +33,24 @@
 public:
 	link_info(io_service& io ) :
-		up(false), local(), remote(), socket(io), connect_retries(0),
+		io(io), up(false), local(), remote(), socket(new bluetooth::rfcomm::socket(io)), connect_retries(0),
 		size(0), buffer(NULL), sending(false) {
 	}
+
+	~link_info() {
+		delete socket;
+	}
+
+	void reinit() {
+		delete socket;
+		socket = new bluetooth::rfcomm::socket(io);
+		up = false;
+	}
+
+	io_service& io;
 
 	// state
 	bool up;
 	rfcomm_endpoint local, remote;
-	bluetooth::rfcomm::socket socket;
+	bluetooth::rfcomm::socket* socket;
 	int connect_retries;
 
@@ -57,5 +69,5 @@
 	if (info != NULL && info->up) {
 		info->up = false;
-		info->socket.shutdown( bluetooth::rfcomm::socket::shutdown_both );
+		info->socket->shutdown( bluetooth::rfcomm::socket::shutdown_both );
 	}
 }
@@ -124,8 +136,9 @@
 
 	// not found, or not up? ->try to (re-)connect
-	if (info==NULL || !info->up || info->socket.is_open() ) {
+	if (info==NULL || !info->up || info->socket->is_open() ) {
 		logging_debug( "Connecting to " << endpoint.to_string() );
-		if (info != NULL && (!info->up || !info->socket.is_open())) {
+		if (info != NULL && (!info->up || !info->socket->is_open())) {
 			logging_debug("Old link is down. Trying to re-establish link.");
+			info->reinit();
 		} else {
 			info = new link_info(io);
@@ -133,5 +146,5 @@
 		info->connect_retries = 0;
 		info->remote = endpoint;
-		info->socket.async_connect( convert(endpoint), boost::bind(
+		info->socket->async_connect( convert(endpoint), boost::bind(
 			&rfcomm::handle_connect, this,
 			boost::asio::placeholders::error, info
@@ -192,5 +205,5 @@
 	// start accepting a connection
 	link_info* info = new link_info(io);
-	acceptor->async_accept(info->socket, boost::bind(
+	acceptor->async_accept(*info->socket, boost::bind(
 		// bind parameters
 		&rfcomm::handle_accept, this,
@@ -221,6 +234,6 @@
 	// convert endpoints
 	info->up = true;
-	info->local  = convert( info->socket.local_endpoint()  );
-	info->remote = convert( info->socket.remote_endpoint() );
+	info->local  = convert( info->socket->local_endpoint()  );
+	info->remote = convert( info->socket->remote_endpoint() );
 
 	logging_debug("Accepted incoming connection from "
@@ -249,7 +262,8 @@
 			// increase counter
 			info->connect_retries++;
+			info->reinit();
 
 			// retry connection attempt
-			info->socket.async_connect( convert(info->remote), boost::bind(
+			info->socket->async_connect( convert(info->remote), boost::bind(
 				&rfcomm::handle_connect, this,
 				boost::asio::placeholders::error, info
@@ -263,6 +277,6 @@
 	// convert endpoints
 	info->up = true;
-	info->local  = convert( info->socket.local_endpoint()  );
-	info->remote = convert( info->socket.remote_endpoint() );
+	info->local  = convert( info->socket->local_endpoint()  );
+	info->remote = convert( info->socket->remote_endpoint() );
 
 	logging_debug( "Connected to " << info->remote.to_string() );
@@ -280,5 +294,5 @@
 void rfcomm::start_read(link_info* info) {
 	// start read
-	boost::asio::async_read(info->socket,
+	boost::asio::async_read(*info->socket,
 
 		// read size of packet
@@ -321,5 +335,5 @@
 
 	// start read
-	boost::asio::async_read(info->socket,
+	boost::asio::async_read(*info->socket,
 		// read size of packet
 		boost::asio::buffer(info->buffer, info->size),
@@ -378,5 +392,5 @@
 
 	// start writing
-	boost::asio::async_write(info->socket,
+	boost::asio::async_write(*info->socket,
 		// read size of packet
 		buffer,
