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 @@ @@ -1 +1 @@
Subproject commit 4448884a3ebf822ecca7b39f2fe9777a79ae1863
Subproject commit abf0f5ac8780c9cb0088e4ccefcd0d0274e63965

12
src/i2p.cpp

@ -13,7 +13,7 @@ namespace SAM @@ -13,7 +13,7 @@ namespace SAM
class StreamSessionAdapter::SessionHolder
{
public:
explicit SessionHolder(std::auto_ptr<SAM::StreamSession> session);
explicit SessionHolder(std::shared_ptr<SAM::StreamSession> session);
const SAM::StreamSession& getSession() const;
SAM::StreamSession& getSession();
@ -21,12 +21,12 @@ private: @@ -21,12 +21,12 @@ private:
void heal() const;
void reborn() const;
mutable std::auto_ptr<SAM::StreamSession> session_;
mutable std::shared_ptr<SAM::StreamSession> session_;
typedef boost::shared_mutex mutex_type;
mutable mutex_type mtx_;
};
StreamSessionAdapter::SessionHolder::SessionHolder(std::auto_ptr<SAM::StreamSession> session)
StreamSessionAdapter::SessionHolder::SessionHolder(std::shared_ptr<SAM::StreamSession> session)
: session_(session)
{}
@ -61,7 +61,7 @@ void StreamSessionAdapter::SessionHolder::reborn() const @@ -61,7 +61,7 @@ void StreamSessionAdapter::SessionHolder::reborn() const
{
if (!session_->isSick())
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())
session_ = newSession;
}
@ -87,14 +87,14 @@ StreamSessionAdapter::~StreamSessionAdapter() @@ -87,14 +87,14 @@ StreamSessionAdapter::~StreamSessionAdapter()
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
return result.isOk ? result.value->release() : SAM_INVALID_SOCKET;
}
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
return result.isOk ? result.value->release() : SAM_INVALID_SOCKET;
}

2
src/i2p.h

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

Loading…
Cancel
Save