Browse Source

fixed build errors

pull/5/head
orignal 7 years ago
parent
commit
d0db9c289f
  1. 2
      i2pd
  2. 12
      src/i2p.cpp
  3. 2
      src/i2p.h

2
i2pd

@ -1 +1 @@
Subproject commit 4448884a3ebf822ecca7b39f2fe9777a79ae1863 Subproject commit abf0f5ac8780c9cb0088e4ccefcd0d0274e63965

12
src/i2p.cpp

@ -13,7 +13,7 @@ namespace SAM
class StreamSessionAdapter::SessionHolder class StreamSessionAdapter::SessionHolder
{ {
public: public:
explicit SessionHolder(std::auto_ptr<SAM::StreamSession> session); explicit SessionHolder(std::shared_ptr<SAM::StreamSession> session);
const SAM::StreamSession& getSession() const; const SAM::StreamSession& getSession() const;
SAM::StreamSession& getSession(); SAM::StreamSession& getSession();
@ -21,12 +21,12 @@ private:
void heal() const; void heal() const;
void reborn() const; void reborn() const;
mutable std::auto_ptr<SAM::StreamSession> session_; mutable std::shared_ptr<SAM::StreamSession> session_;
typedef boost::shared_mutex mutex_type; typedef boost::shared_mutex mutex_type;
mutable mutex_type mtx_; mutable mutex_type mtx_;
}; };
StreamSessionAdapter::SessionHolder::SessionHolder(std::auto_ptr<SAM::StreamSession> session) StreamSessionAdapter::SessionHolder::SessionHolder(std::shared_ptr<SAM::StreamSession> session)
: session_(session) : session_(session)
{} {}
@ -61,7 +61,7 @@ void StreamSessionAdapter::SessionHolder::reborn() const
{ {
if (!session_->isSick()) if (!session_->isSick())
return; return;
std::auto_ptr<SAM::StreamSession> newSession(new SAM::StreamSession(*session_)); std::shared_ptr<SAM::StreamSession> newSession(new SAM::StreamSession(*session_));
if (!newSession->isSick() && session_->isSick()) if (!newSession->isSick() && session_->isSick())
session_ = newSession; session_ = newSession;
} }
@ -87,14 +87,14 @@ StreamSessionAdapter::~StreamSessionAdapter()
SAM::SOCKET StreamSessionAdapter::accept(bool silent) SAM::SOCKET StreamSessionAdapter::accept(bool silent)
{ {
SAM::RequestResult<std::auto_ptr<SAM::Socket> > result = sessionHolder_->getSession().accept(silent); SAM::RequestResult<std::shared_ptr<SAM::Socket> > result = sessionHolder_->getSession().accept(silent);
// call Socket::release // call Socket::release
return result.isOk ? result.value->release() : SAM_INVALID_SOCKET; return result.isOk ? result.value->release() : SAM_INVALID_SOCKET;
} }
SAM::SOCKET StreamSessionAdapter::connect(const std::string& destination, bool silent) SAM::SOCKET StreamSessionAdapter::connect(const std::string& destination, bool silent)
{ {
SAM::RequestResult<std::auto_ptr<SAM::Socket> > result = sessionHolder_->getSession().connect(destination, silent); SAM::RequestResult<std::shared_ptr<SAM::Socket> > result = sessionHolder_->getSession().connect(destination, silent);
// call Socket::release // call Socket::release
return result.isOk ? result.value->release() : SAM_INVALID_SOCKET; return result.isOk ? result.value->release() : SAM_INVALID_SOCKET;
} }

2
src/i2p.h

@ -67,7 +67,7 @@ public:
private: private:
class SessionHolder; class SessionHolder;
std::auto_ptr<SessionHolder> sessionHolder_; std::shared_ptr<SessionHolder> sessionHolder_;
}; };
} // namespace SAM } // namespace SAM

Loading…
Cancel
Save