mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-06 21:01:42 +02:00
Fix server crash if client crashes during connect
This commit is contained in:
parent
3ed76e2059
commit
b23255389f
2 changed files with 14 additions and 4 deletions
|
@ -43,6 +43,19 @@ StreamSession::~StreamSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string StreamSession::getIP()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return socket_.remote_endpoint().address().to_string();
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
return "0.0.0.0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void StreamSession::read_next()
|
void StreamSession::read_next()
|
||||||
{
|
{
|
||||||
boost::asio::async_read(socket_, boost::asio::buffer(buffer_, base_msg_size_),
|
boost::asio::async_read(socket_, boost::asio::buffer(buffer_, base_msg_size_),
|
||||||
|
|
|
@ -128,10 +128,7 @@ public:
|
||||||
|
|
||||||
std::string clientId;
|
std::string clientId;
|
||||||
|
|
||||||
std::string getIP()
|
std::string getIP();
|
||||||
{
|
|
||||||
return socket_.remote_endpoint().address().to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setPcmStream(streamreader::PcmStreamPtr pcmStream);
|
void setPcmStream(streamreader::PcmStreamPtr pcmStream);
|
||||||
const streamreader::PcmStreamPtr pcmStream() const;
|
const streamreader::PcmStreamPtr pcmStream() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue