Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
youngwolf
ascs
提交
f11ce836
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,发现更多精彩内容 >>
提交
f11ce836
编写于
12月 19, 2019
作者:
Y
youngwolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support strict heartbeat sending.
上级
7b78240c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
1 deletion
+7
-1
include/ascs/config.h
include/ascs/config.h
+5
-1
include/ascs/socket.h
include/ascs/socket.h
+2
-0
未找到文件。
include/ascs/config.h
浏览文件 @
f11ce836
...
...
@@ -617,13 +617,14 @@
* HIGHLIGHT:
* Support batch message sent notification, see new macro ASCS_WANT_BATCH_MSG_SEND_NOTIFY for more details.
* Support discarding oldest messages before sending message if the send buffer is insufficient, see macro ASCS_SHRINK_SEND_BUFFER for more details.
* Add resend_msg and sync_resend_msg interface to ascs::socket, it takes packed messages and insert them into the front of the send buffer.
*
* FIX:
* If defined macro ASCS_WANT_MSG_SEND_NOTIFY, virtual function ascs::socket::on_msg_send(InMsgType& msg) must be implemented.
* If defined macro ASCS_WANT_ALL_MSG_SEND_NOTIFY, virtual function ascs::socket::on_all_msg_send(InMsgType& msg) must be implemented.
*
* ENHANCEMENTS:
*
Add resend_msg and sync_resend_msg interface to ascs::socket, it takes packed messages and insert them into the front of the send buffer
.
*
Support strict heartbeat sending, see macro ASCS_ALWAYS_SEND_HEARTBEAT for more details
.
* Add socket_exist interface to i_matrix, it calls object_pool::exist to check the existence of a socket by an given id.
* Add following 3 interfaces to i_unpacker as i_packer did (the default implementation is meaningless as i_packer, just satisfy compilers):
* virtual char* raw_data(msg_type& msg) const
...
...
@@ -922,6 +923,9 @@ static_assert(ASCS_ASYNC_ACCEPT_NUM > 0, "async accept number must be bigger tha
static_assert
(
ASCS_HEARTBEAT_MAX_ABSENCE
>
0
,
"heartbeat absence must be bigger than zero."
);
//if no any messages (include heartbeat) been received within ASCS_HEARTBEAT_INTERVAL * ASCS_HEARTBEAT_MAX_ABSENCE second(s), shut down the link.
//#define ASCS_ALWAYS_SEND_HEARTBEAT
//always send heartbeat in each ASCS_HEARTBEAT_INTERVAL seconds without checking if we're sending other messages or not.
//#define ASCS_REUSE_SSL_STREAM
//if you need ssl::client_socket_base to be able to reconnect the server, or to open object pool in ssl::object_pool, you must define this macro.
//I tried many ways, only one way can make asio::ssl::stream reusable, which is:
...
...
include/ascs/socket.h
浏览文件 @
f11ce836
...
...
@@ -172,7 +172,9 @@ public:
if
(
!
on_heartbeat_error
())
return
false
;
#ifndef ASCS_ALWAYS_SEND_HEARTBEAT
if
(
!
sending
&&
now
-
stat
.
last_send_time
>=
interval
)
//don't need to send heartbeat if we're sending messages
#endif
send_heartbeat
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录