提交 4d3e285a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

More cleanup.

上级 e1989577
......@@ -18,13 +18,12 @@ public:
~Loop();
private:
RTC::Room* GetRoomFromRequest(Channel::Request* request, unsigned int* roomId = nullptr);
void Close();
RTC::Room* GetRoomFromRequest(Channel::Request* request, unsigned int* roomId = nullptr);
/* Methods inherited from SignalsHandler::Listener. */
public:
virtual void onSignal(SignalsHandler* signalsHandler, int signum) override;
virtual void onSignalsHandlerClosed(SignalsHandler* signalsHandler) override;
/* Methods inherited from Channel::lUnixStreamSocket::Listener. */
public:
......
......@@ -12,7 +12,6 @@ public:
{
public:
virtual void onSignal(SignalsHandler* signalsHandler, int signum) = 0;
virtual void onSignalsHandlerClosed(SignalsHandler* signalsHandler) = 0;
};
public:
......
......@@ -39,35 +39,6 @@ Loop::~Loop()
MS_TRACE();
}
RTC::Room* Loop::GetRoomFromRequest(Channel::Request* request, unsigned int* roomId)
{
MS_TRACE();
static const Json::StaticString k_roomId("roomId");
auto jsonRoomId = request->data[k_roomId];
if (!jsonRoomId.isUInt())
MS_THROW_ERROR("Request has not numeric .roomId field");
// If given, fill roomId.
if (roomId)
*roomId = jsonRoomId.asUInt();
auto it = this->rooms.find(jsonRoomId.asUInt());
if (it != this->rooms.end())
{
RTC::Room* room = it->second;
return room;
}
else
{
return nullptr;
}
}
void Loop::Close()
{
MS_TRACE();
......@@ -110,6 +81,35 @@ void Loop::Close()
this->channel->Close();
}
RTC::Room* Loop::GetRoomFromRequest(Channel::Request* request, unsigned int* roomId)
{
MS_TRACE();
static const Json::StaticString k_roomId("roomId");
auto jsonRoomId = request->data[k_roomId];
if (!jsonRoomId.isUInt())
MS_THROW_ERROR("Request has not numeric .roomId field");
// If given, fill roomId.
if (roomId)
*roomId = jsonRoomId.asUInt();
auto it = this->rooms.find(jsonRoomId.asUInt());
if (it != this->rooms.end())
{
RTC::Room* room = it->second;
return room;
}
else
{
return nullptr;
}
}
void Loop::onSignal(SignalsHandler* signalsHandler, int signum)
{
MS_TRACE();
......@@ -131,13 +131,6 @@ void Loop::onSignal(SignalsHandler* signalsHandler, int signum)
}
}
void Loop::onSignalsHandlerClosed(SignalsHandler* signalsHandler)
{
MS_TRACE();
this->signalsHandler = nullptr;
}
void Loop::onChannelRequest(Channel::UnixStreamSocket* channel, Channel::Request* request)
{
MS_TRACE();
......
......@@ -60,9 +60,6 @@ void SignalsHandler::Close()
uv_close((uv_handle_t*)uvHandle, (uv_close_cb)on_close);
}
// Notify the listener.
this->listener->onSignalsHandlerClosed(this);
// And delete this.
delete this;
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论