mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-28 17:57:05 +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()
|
||||
{
|
||||
boost::asio::async_read(socket_, boost::asio::buffer(buffer_, base_msg_size_),
|
||||
|
|
|
@ -128,10 +128,7 @@ public:
|
|||
|
||||
std::string clientId;
|
||||
|
||||
std::string getIP()
|
||||
{
|
||||
return socket_.remote_endpoint().address().to_string();
|
||||
}
|
||||
std::string getIP();
|
||||
|
||||
void setPcmStream(streamreader::PcmStreamPtr pcmStream);
|
||||
const streamreader::PcmStreamPtr pcmStream() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue