Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
46f3a9c0
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
46f3a9c0
编写于
11月 13, 2015
作者:
E
Enrico Giordani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Fix] Duplicated sockets management for diskless replication.
上级
5ebdc7e3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
12 deletion
+16
-12
src/Win32_Interop/Win32_QFork.cpp
src/Win32_Interop/Win32_QFork.cpp
+10
-8
src/Win32_Interop/Win32_QFork_impl.c
src/Win32_Interop/Win32_QFork_impl.c
+6
-4
未找到文件。
src/Win32_Interop/Win32_QFork.cpp
浏览文件 @
46f3a9c0
...
...
@@ -354,16 +354,17 @@ BOOL QForkChildInit(HANDLE QForkControlMemoryMapHandle, DWORD ParentProcessID) {
}
else
if
(
g_pQForkControl
->
typeOfOperation
==
OperationType
::
otSocket
)
{
LPWSAPROTOCOL_INFO
lpProtocolInfo
=
(
LPWSAPROTOCOL_INFO
)
g_pQForkControl
->
globalData
.
protocolInfo
;
int
pipe_write_fd
=
FDAPI_open_osfhandle
((
intptr_t
)
g_pQForkControl
->
globalData
.
pipe_write_handle
,
_O_APPEND
);
int
*
fds
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
g_pQForkControl
->
globalData
.
numfds
);
for
(
int
i
=
0
;
i
<
g_pQForkControl
->
globalData
.
numfds
;
i
++
)
{
g_pQForkControl
->
globalData
.
fds
[
i
]
=
FDAPI_WSASocket
(
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
,
&
lpProtocolInfo
[
i
],
0
,
WSA_FLAG_OVERLAPPED
);
fds
[
i
]
=
FDAPI_WSASocket
(
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
,
&
lpProtocolInfo
[
i
],
0
,
WSA_FLAG_OVERLAPPED
);
}
g_ChildExitCode
=
do_socketSave
(
g_pQForkControl
->
globalData
.
fds
,
g_ChildExitCode
=
do_socketSave
(
fds
,
g_pQForkControl
->
globalData
.
numfds
,
g_pQForkControl
->
globalData
.
clientids
,
pipe_write_fd
);
...
...
@@ -371,8 +372,9 @@ BOOL QForkChildInit(HANDLE QForkControlMemoryMapHandle, DWORD ParentProcessID) {
// Failing to close the sockets properly will produce a socket read error
// on both the parent process and the slave.
for
(
int
i
=
0
;
i
<
g_pQForkControl
->
globalData
.
numfds
;
i
++
)
{
FDAPI_CloseDuplicatedSocket
(
g_pQForkControl
->
globalData
.
fds
[
i
]);
FDAPI_CloseDuplicatedSocket
(
fds
[
i
]);
}
free
(
fds
);
}
else
{
throw
runtime_error
(
"unexpected operation type"
);
}
...
...
src/Win32_Interop/Win32_QFork_impl.c
浏览文件 @
46f3a9c0
...
...
@@ -21,6 +21,7 @@
*/
#include "..\redis.h"
#include "Win32_Portability.h"
void
SetupRedisGlobals
(
LPVOID
redisData
,
size_t
redisDataSize
,
uint32_t
dictHashSeed
)
{
...
...
@@ -74,12 +75,13 @@ int do_rdbSaveToSlavesSockets(int *fds, int numfds, uint64_t *clientids)
server
.
rdb_child_pid
=
GetCurrentProcessId
();
rioInitWithFdset
(
&
slave_sockets
,
fds
,
numfds
);
zfree
(
fds
);
// On Windows we need to use the fds after do_socketSave2 has finished
// so we don't free them here, moreover since we allocate the fds in
// QFork.cpp it's better to use malloc instead of zmalloc.
POSIX_ONLY
(
zfree
(
fds
););
// On Windows we haven't duplicated the listening sockets so we shouldn't close them
#ifndef _WIN32
closeListeningSockets
(
0
);
#endif
POSIX_ONLY
(
closeListeningSockets
(
0
);)
redisSetProcTitle
(
"redis-rdb-to-slaves"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录