Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
youngwolf
ascs
提交
3eb335ad
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,发现更多精彩内容 >>
提交
3eb335ad
编写于
2月 27, 2019
作者:
Y
yang li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make function tcp::socket_base::reset to be virtual.
上级
6b8936db
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
12 deletion
+7
-12
include/ascs/config.h
include/ascs/config.h
+1
-0
include/ascs/tcp/client_socket.h
include/ascs/tcp/client_socket.h
+0
-5
include/ascs/tcp/server_socket.h
include/ascs/tcp/server_socket.h
+0
-5
include/ascs/tcp/socket.h
include/ascs/tcp/socket.h
+6
-2
未找到文件。
include/ascs/config.h
浏览文件 @
3eb335ad
...
...
@@ -479,6 +479,7 @@
* ASCS_MAX_SEND_BUF and ASCS_MAX_RECV_BUF, and unit been changed to byte.
* statistic.send_msg_sum may be bigger than before (but statistic.send_byte_sum will be the same), see ENHANCEMENTS section for more details.
* Not support gcc 4.6 any more, please use st_asio_wrapper instead.
* Make function tcp::socket_base::reset to be virtual.
*
* HIGHLIGHT:
* Make client_socket_base be able to call multi_client_base (via i_matrix) like server_socket_base call server_base (via i_server),
...
...
include/ascs/tcp/client_socket.h
浏览文件 @
3eb335ad
...
...
@@ -39,11 +39,6 @@ public:
virtual
const
char
*
type_name
()
const
{
return
"TCP (client endpoint)"
;}
virtual
int
type_id
()
const
{
return
1
;}
//reset all, be ensure that there's no any operations performed on this socket when invoke it
//subclass must re-write this function to initialize itself, and then do not forget to invoke superclass' reset function too
//notice, when reusing this socket, object_pool will invoke this function, so if you want to do some additional initialization
// for this socket, do it at here and in the constructor.
//for tcp::single_client_base and ssl::single_client_base, this virtual function will never be called, please note.
virtual
void
reset
()
{
need_reconnect
=
ASCS_RECONNECT
;
super
::
reset
();}
bool
set_server_addr
(
unsigned
short
port
,
const
std
::
string
&
ip
=
ASCS_SERVER_IP
)
{
return
set_addr
(
server_addr
,
port
,
ip
);}
...
...
include/ascs/tcp/server_socket.h
浏览文件 @
3eb335ad
...
...
@@ -34,11 +34,6 @@ public:
virtual
const
char
*
type_name
()
const
{
return
"TCP (server endpoint)"
;}
virtual
int
type_id
()
const
{
return
2
;}
//reset all, be ensure that there's no any operations performed on this socket when invoke it
//subclass must re-write this function to initialize itself, and then do not forget to invoke superclass' reset function too
//notice, when reusing this socket, object_pool will invoke this function, so if you want to do some additional initialization
// for this socket, do it at here and in the constructor.
virtual
void
reset
()
{
super
::
reset
();}
virtual
void
take_over
(
std
::
shared_ptr
<
server_socket_base
>
socket_ptr
)
{}
//restore this socket from socket_ptr
void
disconnect
()
{
force_shutdown
();}
...
...
include/ascs/tcp/socket.h
浏览文件 @
3eb335ad
...
...
@@ -54,8 +54,12 @@ public:
do_direct_send_msg
(
std
::
move
(
msg
));
}
//reset all, be ensure that there's no any operations performed on this tcp::socket_base when invoke it
void
reset
()
{
status
=
link_status
::
BROKEN
;
last_send_msg
.
clear
();
unpacker_
->
reset
();
super
::
reset
();}
//reset all, be ensure that there's no any operations performed on this socket when invoke it
//subclass must re-write this function to initialize itself, and then do not forget to invoke superclass' reset function too
//notice, when reusing this socket, object_pool will invoke this function, so if you want to do some additional initialization
// for this socket, do it at here and in the constructor.
//for tcp::single_client_base and ssl::single_client_base, this virtual function will never be called, please note.
virtual
void
reset
()
{
status
=
link_status
::
BROKEN
;
last_send_msg
.
clear
();
unpacker_
->
reset
();
super
::
reset
();}
//SOCKET status
bool
is_broken
()
const
{
return
link_status
::
BROKEN
==
status
;}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录