mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-03-13 05:41:11 +00:00
write SAM messages to sam.log
This commit is contained in:
parent
d0db9c289f
commit
9871500bc2
@ -586,7 +586,7 @@ std::ostream& StreamSession::getLogStream ()
|
|||||||
|
|
||||||
void StreamSession::SetLogFile (const std::string& filename)
|
void StreamSession::SetLogFile (const std::string& filename)
|
||||||
{
|
{
|
||||||
logStream = std::make_shared<std::ofstream> (filename, std::ofstream::out | std::ofstream::app);
|
logStream = std::make_shared<std::ofstream> (filename, std::ofstream::out | std::ofstream::trunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamSession::CloseLogFile ()
|
void StreamSession::CloseLogFile ()
|
||||||
|
24
src/i2p.cpp
24
src/i2p.cpp
@ -14,6 +14,7 @@ class StreamSessionAdapter::SessionHolder
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SessionHolder(std::shared_ptr<SAM::StreamSession> session);
|
explicit SessionHolder(std::shared_ptr<SAM::StreamSession> session);
|
||||||
|
~SessionHolder();
|
||||||
|
|
||||||
const SAM::StreamSession& getSession() const;
|
const SAM::StreamSession& getSession() const;
|
||||||
SAM::StreamSession& getSession();
|
SAM::StreamSession& getSession();
|
||||||
@ -28,7 +29,12 @@ private:
|
|||||||
|
|
||||||
StreamSessionAdapter::SessionHolder::SessionHolder(std::shared_ptr<SAM::StreamSession> session)
|
StreamSessionAdapter::SessionHolder::SessionHolder(std::shared_ptr<SAM::StreamSession> session)
|
||||||
: session_(session)
|
: session_(session)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamSessionAdapter::SessionHolder::~SessionHolder()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
const SAM::StreamSession& StreamSessionAdapter::SessionHolder::getSession() const
|
const SAM::StreamSession& StreamSessionAdapter::SessionHolder::getSession() const
|
||||||
{
|
{
|
||||||
@ -76,14 +82,18 @@ StreamSessionAdapter::StreamSessionAdapter(
|
|||||||
const std::string& i2pOptions /*= SAM_DEFAULT_I2P_OPTIONS*/,
|
const std::string& i2pOptions /*= SAM_DEFAULT_I2P_OPTIONS*/,
|
||||||
const std::string& minVer /*= SAM_DEFAULT_MIN_VER*/,
|
const std::string& minVer /*= SAM_DEFAULT_MIN_VER*/,
|
||||||
const std::string& maxVer /*= SAM_DEFAULT_MAX_VER*/)
|
const std::string& maxVer /*= SAM_DEFAULT_MAX_VER*/)
|
||||||
: sessionHolder_(
|
{
|
||||||
new SessionHolder(
|
SAM::StreamSession::SetLogFile ((GetDataDir() / "sam.log").string ());
|
||||||
std::auto_ptr<SAM::StreamSession>(
|
std::cout << "Creating SAM session ..." << std::endl;
|
||||||
new SAM::StreamSession(nickname, SAMHost, SAMPort, myDestination, i2pOptions, minVer, maxVer))))
|
auto s = std::make_shared<SAM::StreamSession>(nickname, SAMHost, SAMPort, myDestination, i2pOptions, minVer, maxVer);
|
||||||
{}
|
sessionHolder_ = std::make_shared<SessionHolder>(s);
|
||||||
|
std::cout << "SAM session created" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
StreamSessionAdapter::~StreamSessionAdapter()
|
StreamSessionAdapter::~StreamSessionAdapter()
|
||||||
{}
|
{
|
||||||
|
SAM::StreamSession::CloseLogFile ();
|
||||||
|
}
|
||||||
|
|
||||||
SAM::SOCKET StreamSessionAdapter::accept(bool silent)
|
SAM::SOCKET StreamSessionAdapter::accept(bool silent)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user