Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
youngwolf
ascs
提交
9d93fcb9
A
ascs
项目概览
youngwolf
/
ascs
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ascs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9d93fcb9
编写于
8月 22, 2018
作者:
Y
YangLi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compilation error for replaceable_udp_unpacker.
Fix duration statistic.
上级
afbc60e6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
9 addition
and
7 deletion
+9
-7
examples/ssl_test/ssl_test.cpp
examples/ssl_test/ssl_test.cpp
+3
-1
examples/udp_test/udp_test.cpp
examples/udp_test/udp_test.cpp
+1
-1
include/ascs/base.h
include/ascs/base.h
+2
-2
include/ascs/ext/unpacker.h
include/ascs/ext/unpacker.h
+1
-1
include/ascs/timer.h
include/ascs/timer.h
+0
-1
include/ascs/udp/socket.h
include/ascs/udp/socket.h
+2
-1
未找到文件。
examples/ssl_test/ssl_test.cpp
浏览文件 @
9d93fcb9
...
...
@@ -76,7 +76,9 @@ int main(int argc, const char* argv[])
{
std
::
string
str
;
std
::
cin
>>
str
;
if
(
QUIT_COMMAND
==
str
)
if
(
str
.
empty
())
;
else
if
(
QUIT_COMMAND
==
str
)
{
sp
.
stop_service
(
&
client_
);
sp
.
stop_service
();
...
...
examples/udp_test/udp_test.cpp
浏览文件 @
9d93fcb9
...
...
@@ -6,6 +6,7 @@
//so, define this to avoid hooks for async call (and slightly improve efficiency),
//any value which is bigger than zero is okay.
#define ASCS_SYNC_RECV
#define ASCS_SYNC_SEND
#define ASCS_PASSIVE_RECV //if you annotate this definition, this demo will use mix model to receive messages, which means
//some messages will be dispatched via on_msg_handle(), some messages will be returned via sync_recv_msg(),
//type more than one messages (separate them by space) in one line with ENTER key to send them,
...
...
@@ -13,7 +14,6 @@
//#define ASCS_DEFAULT_UDP_UNPACKER replaceable_udp_unpacker<>
#define ASCS_HEARTBEAT_INTERVAL 5 //neither udp_unpacker nor replaceable_udp_unpacker support heartbeat message,
//so heartbeat will be treated as normal message.
#define ASCS_SYNC_SEND
//configuration
#include <ascs/ext/udp.h>
...
...
include/ascs/base.h
浏览文件 @
9d93fcb9
...
...
@@ -208,7 +208,7 @@ protected:
virtual
~
i_unpacker
()
{}
public:
virtual
void
reset
()
{}
;
virtual
void
reset
()
{}
//heartbeat must not be included in msg_can, otherwise you must handle heartbeat at where you handle normal messges.
virtual
bool
parse_msg
(
size_t
bytes_transferred
,
container_type
&
msg_can
)
=
0
;
virtual
size_t
completion_condition
(
const
asio
::
error_code
&
ec
,
size_t
bytes_transferred
)
{
return
0
;}
...
...
@@ -371,7 +371,7 @@ template<typename T>
struct
obj_with_begin_time
:
public
T
{
obj_with_begin_time
(
bool
need_cv
=
false
)
{
check_and_create_cv
(
need_cv
);}
obj_with_begin_time
(
T
&&
obj
,
bool
need_cv
=
false
)
:
T
(
std
::
move
(
obj
))
{
check_and_create_cv
(
need_cv
);}
obj_with_begin_time
(
T
&&
obj
,
bool
need_cv
=
false
)
:
T
(
std
::
move
(
obj
))
{
restart
();
check_and_create_cv
(
need_cv
);}
obj_with_begin_time
&
operator
=
(
T
&&
obj
)
{
T
::
operator
=
(
std
::
move
(
obj
));
restart
();
return
*
this
;}
obj_with_begin_time
(
obj_with_begin_time
&&
other
)
:
T
(
std
::
move
(
other
)),
begin_time
(
std
::
move
(
other
.
begin_time
)),
cv
(
std
::
move
(
other
.
cv
))
{}
obj_with_begin_time
&
operator
=
(
obj_with_begin_time
&&
other
)
{
T
::
operator
=
(
std
::
move
(
other
));
begin_time
=
std
::
move
(
other
.
begin_time
);
cv
=
std
::
move
(
other
.
cv
);
return
*
this
;}
...
...
include/ascs/ext/unpacker.h
浏览文件 @
9d93fcb9
...
...
@@ -185,7 +185,7 @@ private:
typedef
ascs
::
i_unpacker
<
T
>
super
;
public:
virtual
typename
super
::
msg_type
parse_msg
(
size_t
bytes_transferred
,
typename
super
::
container_type
&
msg_can
)
virtual
bool
parse_msg
(
size_t
bytes_transferred
,
typename
super
::
container_type
&
msg_can
)
{
assert
(
bytes_transferred
<=
ASCS_MSG_BUFFER_SIZE
);
...
...
include/ascs/timer.h
浏览文件 @
9d93fcb9
...
...
@@ -185,4 +185,3 @@ private:
}
//namespace
#endif
/* _ASCS_TIMER_H_ */
include/ascs/udp/socket.h
浏览文件 @
9d93fcb9
...
...
@@ -234,7 +234,8 @@ private:
this
->
stat
.
send_time_sum
+=
statistic
::
now
()
-
last_send_msg
.
begin_time
;
++
this
->
stat
.
send_msg_sum
;
#ifdef ASCS_SYNC_SEND
if
(
last_send_msg
.
cv
)
last_send_msg
.
cv
->
notify_one
();
if
(
last_send_msg
.
cv
)
last_send_msg
.
cv
->
notify_one
();
#endif
#ifdef ASCS_WANT_MSG_SEND_NOTIFY
this
->
on_msg_send
(
last_send_msg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录