From 2f976214ce1b3fb711a23101662631f8e0308d47 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 28 May 2019 10:02:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmedia=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Shell/{ShellCMD.cpp => ShellCMD.h} | 47 ++++++++++++-------------- src/Shell/ShellSession.cpp | 8 +++-- 2 files changed, 27 insertions(+), 28 deletions(-) rename src/Shell/{ShellCMD.cpp => ShellCMD.h} (73%) diff --git a/src/Shell/ShellCMD.cpp b/src/Shell/ShellCMD.h similarity index 73% rename from src/Shell/ShellCMD.cpp rename to src/Shell/ShellCMD.h index eacc6c9f..8017639c 100644 --- a/src/Shell/ShellCMD.cpp +++ b/src/Shell/ShellCMD.h @@ -45,31 +45,33 @@ public: return; } - if(ini.find("kick") != ini.end()){ - //踢出源 - do{ - if(!media) { - break; - } - if(!media->close(true)) { - break; - } - (*stream) << "\t踢出成功:" + EventPollerPool::Instance().getPoller()->async([ini,media,stream,schema,vhost,app,streamid](){ + if(ini.find("kick") != ini.end()){ + //踢出源 + do{ + if(!media) { + break; + } + if(!media->close(true)) { + break; + } + (*stream) << "\t踢出成功:" + << schema << "/" + << vhost << "/" + << app << "/" + << streamid + << "\r\n"; + return; + }while(0); + (*stream) << "\t踢出失败:" << schema << "/" << vhost << "/" << app << "/" << streamid << "\r\n"; - return; - }while(0); - (*stream) << "\t踢出失败:" - << schema << "/" - << vhost << "/" - << app << "/" - << streamid - << "\r\n"; - return; - } + } + },false); + }); })); @@ -86,11 +88,6 @@ public: } }; -void installShellCMD(){ - static onceToken s_token([]() { - REGIST_CMD(media); - }, nullptr); -} diff --git a/src/Shell/ShellSession.cpp b/src/Shell/ShellSession.cpp index 531f1d6d..bc308499 100644 --- a/src/Shell/ShellSession.cpp +++ b/src/Shell/ShellSession.cpp @@ -25,18 +25,20 @@ */ #include "ShellSession.h" -#include "Common/config.h" #include "Util/CMD.h" #include "Util/onceToken.h" #include "Util/NoticeCenter.h" +#include "Common/config.h" +#include "ShellCMD.h" using namespace toolkit; namespace mediakit { -extern void installShellCMD(); +static onceToken s_token([]() { + REGIST_CMD(media); +}, nullptr); ShellSession::ShellSession(const Socket::Ptr &_sock) : TcpSession(_sock) { - installShellCMD(); pleaseInputUser(); }