Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hanoi2005
redis
提交
d775b357
R
redis
项目概览
hanoi2005
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
d775b357
编写于
11月 01, 2012
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Unix socket clients properly displayed in MONITOR and CLIENT LIST.
This also fixes issue #745.
上级
655e6838
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
8 deletion
+15
-8
src/networking.c
src/networking.c
+10
-6
src/redis.h
src/redis.h
+1
-0
src/replication.c
src/replication.c
+4
-2
未找到文件。
src/networking.c
浏览文件 @
d775b357
...
...
@@ -486,7 +486,7 @@ void copyClientOutputBuffer(redisClient *dst, redisClient *src) {
dst
->
reply_bytes
=
src
->
reply_bytes
;
}
static
void
acceptCommonHandler
(
int
fd
)
{
static
void
acceptCommonHandler
(
int
fd
,
int
flags
)
{
redisClient
*
c
;
if
((
c
=
createClient
(
fd
))
==
NULL
)
{
redisLog
(
REDIS_WARNING
,
"Error allocating resoures for the client"
);
...
...
@@ -509,6 +509,7 @@ static void acceptCommonHandler(int fd) {
return
;
}
server
.
stat_numconnections
++
;
c
->
flags
|=
flags
;
}
void
acceptTcpHandler
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
int
mask
)
{
...
...
@@ -524,7 +525,7 @@ void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
return
;
}
redisLog
(
REDIS_VERBOSE
,
"Accepted %s:%d"
,
cip
,
cport
);
acceptCommonHandler
(
cfd
);
acceptCommonHandler
(
cfd
,
0
);
}
void
acceptUnixHandler
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
int
mask
)
{
...
...
@@ -539,7 +540,7 @@ void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
return
;
}
redisLog
(
REDIS_VERBOSE
,
"Accepted connection to %s"
,
server
.
unixsocket
);
acceptCommonHandler
(
cfd
);
acceptCommonHandler
(
cfd
,
REDIS_UNIX_SOCKET
);
}
...
...
@@ -1062,10 +1063,11 @@ void getClientsMaxBuffers(unsigned long *longest_output_list,
/* Turn a Redis client into an sds string representing its state. */
sds
getClientInfoString
(
redisClient
*
client
)
{
char
ip
[
32
],
flags
[
16
],
events
[
3
],
*
p
;
int
port
;
int
port
=
0
;
/* initialized to zero for the unix socket case. */
int
emask
;
anetPeerToString
(
client
->
fd
,
ip
,
&
port
);
if
(
!
(
client
->
flags
&
REDIS_UNIX_SOCKET
))
anetPeerToString
(
client
->
fd
,
ip
,
&
port
);
p
=
flags
;
if
(
client
->
flags
&
REDIS_SLAVE
)
{
if
(
client
->
flags
&
REDIS_MONITOR
)
...
...
@@ -1080,6 +1082,7 @@ sds getClientInfoString(redisClient *client) {
if
(
client
->
flags
&
REDIS_CLOSE_AFTER_REPLY
)
*
p
++
=
'c'
;
if
(
client
->
flags
&
REDIS_UNBLOCKED
)
*
p
++
=
'u'
;
if
(
client
->
flags
&
REDIS_CLOSE_ASAP
)
*
p
++
=
'A'
;
if
(
client
->
flags
&
REDIS_UNIX_SOCKET
)
*
p
++
=
'U'
;
if
(
p
==
flags
)
*
p
++
=
'N'
;
*
p
++
=
'\0'
;
...
...
@@ -1090,7 +1093,8 @@ sds getClientInfoString(redisClient *client) {
*
p
=
'\0'
;
return
sdscatprintf
(
sdsempty
(),
"addr=%s:%d fd=%d age=%ld idle=%ld flags=%s db=%d sub=%d psub=%d multi=%d qbuf=%lu qbuf-free=%lu obl=%lu oll=%lu omem=%lu events=%s cmd=%s"
,
ip
,
port
,
client
->
fd
,
(
client
->
flags
&
REDIS_UNIX_SOCKET
)
?
server
.
unixsocket
:
ip
,
port
,
client
->
fd
,
(
long
)(
server
.
unixtime
-
client
->
ctime
),
(
long
)(
server
.
unixtime
-
client
->
lastinteraction
),
flags
,
...
...
src/redis.h
浏览文件 @
d775b357
...
...
@@ -152,6 +152,7 @@
#define REDIS_LUA_CLIENT 512
/* This is a non connected client used by Lua */
#define REDIS_ASKING 1024
/* Client issued the ASKING command */
#define REDIS_CLOSE_ASAP 2048
/* Close this client ASAP */
#define REDIS_UNIX_SOCKET 4096
/* Client connected via Unix domain socket */
/* Client request types */
#define REDIS_REQ_INLINE 1
...
...
src/replication.c
浏览文件 @
d775b357
...
...
@@ -54,10 +54,12 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **
gettimeofday
(
&
tv
,
NULL
);
cmdrepr
=
sdscatprintf
(
cmdrepr
,
"%ld.%06ld "
,(
long
)
tv
.
tv_sec
,(
long
)
tv
.
tv_usec
);
if
(
c
->
flags
&
REDIS_LUA_CLIENT
)
{
cmdrepr
=
sdscatprintf
(
cmdrepr
,
"[%d lua] "
,
dictid
);
cmdrepr
=
sdscatprintf
(
cmdrepr
,
"[%d lua] "
,
dictid
);
}
else
if
(
c
->
flags
&
REDIS_UNIX_SOCKET
)
{
cmdrepr
=
sdscatprintf
(
cmdrepr
,
"[%d unix:%s] "
,
dictid
,
server
.
unixsocket
);
}
else
{
anetPeerToString
(
c
->
fd
,
ip
,
&
port
);
cmdrepr
=
sdscatprintf
(
cmdrepr
,
"[%d %s:%d] "
,
dictid
,
ip
,
port
);
cmdrepr
=
sdscatprintf
(
cmdrepr
,
"[%d %s:%d] "
,
dictid
,
ip
,
port
);
}
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录