forked from p308945/MyNetWorkLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyClientTask.cpp
More file actions
41 lines (39 loc) · 1.05 KB
/
MyClientTask.cpp
File metadata and controls
41 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*************************************************************************
> File Name: MyClientTask.cpp
> Author: huangyun
> Mail: 895175589@qq.com
> Created Time: Sat 08 Aug 2015 11:22:40 PM
************************************************************************/
#include "MyClientTask.h"
#include "../proto/BaseCmd.h"
namespace MyNameSpace
{
bool MyClientTask::cmdParse(const char *msg, int len)
{
std::cout<<"len: "<<len<<"msg: "<<msg<<std::endl;
if (mInnerDispatcher && mOutterDispatcher)
{
const Command::BaseCommand *pCmd = reinterpret_cast<const Command::BaseCommand *>(msg);
switch(pCmd->mType)
{
case Command::COMMAND_TYPE::INNER:
{
mInnerDispatcher->dispatcher(pCmd, len, getId());
}
break;
case Command::COMMAND_TYPE::OUTTER:
{
mOutterDispatcher->dispatcher(pCmd, len, getId());
}
break;
default:
{
std::cerr<<__FUNCTION__<<": "<<__LINE__<<"type "<<(int)pCmd->mType<<" error"<<std::endl;
return false;
}
break;
}
}
return true;
}
}