transport/unix: Fixing segfault due to errorneous creation of multiple UnixTransport::Impl instances

The bug showed itself when multiple expressInterest's were issued before
running processEvents.

Change-Id: I7e60d0ae625777e06471aca00707d7b88e68a5c8
diff --git a/include/ndn-cpp/transport/unix-transport.hpp b/include/ndn-cpp/transport/unix-transport.hpp
index b7b65a9..c2ee204 100644
--- a/include/ndn-cpp/transport/unix-transport.hpp
+++ b/include/ndn-cpp/transport/unix-transport.hpp
@@ -34,7 +34,7 @@
   std::string unixSocket_;
 
   class Impl;
-  std::auto_ptr<Impl> impl_;
+  ptr_lib::shared_ptr<Impl> impl_;
 };
 
 }
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index 5ee6a61..5aca79e 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -246,9 +246,11 @@
 UnixTransport::connect(boost::asio::io_service &ioService,
                        const ReceiveCallback &receiveCallback)
 {
-  Transport::connect(ioService, receiveCallback);
+  if (!static_cast<bool>(impl_)) {
+    Transport::connect(ioService, receiveCallback);
   
-  impl_ = std::auto_ptr<UnixTransport::Impl> (new UnixTransport::Impl(*this));
+    impl_ = ptr_lib::make_shared<UnixTransport::Impl> (ptr_lib::ref(*this));
+  }
   impl_->connect();
 }