Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
6ed17a99
Commit
6ed17a99
authored
Aug 08, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WILL NEED TO REVERT: pong ident (breaks RedisLabs)
parent
82d2ac49
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
17 deletions
+27
-17
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+2
-2
RedisBase.cs
StackExchange.Redis/StackExchange/Redis/RedisBase.cs
+1
-1
RedisDatabase.cs
StackExchange.Redis/StackExchange/Redis/RedisDatabase.cs
+2
-2
RedisLiterals.cs
StackExchange.Redis/StackExchange/Redis/RedisLiterals.cs
+9
-2
RedisTransaction.cs
StackExchange.Redis/StackExchange/Redis/RedisTransaction.cs
+2
-2
ResultProcessor.cs
StackExchange.Redis/StackExchange/Redis/ResultProcessor.cs
+7
-4
ServerEndPoint.cs
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
+4
-4
No files found.
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
6ed17a99
...
...
@@ -240,13 +240,13 @@ internal void KeepAlive()
switch
(
ConnectionType
)
{
case
ConnectionType
.
Interactive
:
msg
=
ServerEndPoint
.
GetTracerMessage
(
false
);
msg
=
ServerEndPoint
.
GetTracerMessage
(
false
,
"pong hb"
);
msg
.
SetSource
(
ResultProcessor
.
Tracer
,
null
);
break
;
case
ConnectionType
.
Subscription
:
if
(
commandMap
.
IsAvailable
(
RedisCommand
.
PING
)
&&
ServerEndPoint
.
GetFeatures
().
PingOnSubscriber
)
{
msg
=
Message
.
Create
(-
1
,
CommandFlags
.
FireAndForget
,
RedisCommand
.
PING
);
msg
=
Message
.
Create
(-
1
,
CommandFlags
.
FireAndForget
,
RedisCommand
.
PING
,
(
RedisValue
)
"pong sub"
);
msg
.
SetSource
(
ResultProcessor
.
Tracer
,
null
);
}
else
if
(
commandMap
.
IsAvailable
(
RedisCommand
.
UNSUBSCRIBE
))
...
...
StackExchange.Redis/StackExchange/Redis/RedisBase.cs
View file @
6ed17a99
...
...
@@ -103,7 +103,7 @@ private ResultProcessor.TimingProcessor.TimerMessage GetTimerMessage(CommandFlag
// do the best we can with available commands
var
map
=
multiplexer
.
CommandMap
;
if
(
map
.
IsAvailable
(
RedisCommand
.
PING
))
return
ResultProcessor
.
TimingProcessor
.
CreateMessage
(-
1
,
flags
,
RedisCommand
.
PING
);
return
ResultProcessor
.
TimingProcessor
.
CreateMessage
(-
1
,
flags
,
RedisCommand
.
PING
,
"pong time"
);
if
(
map
.
IsAvailable
(
RedisCommand
.
TIME
))
return
ResultProcessor
.
TimingProcessor
.
CreateMessage
(-
1
,
flags
,
RedisCommand
.
TIME
);
if
(
map
.
IsAvailable
(
RedisCommand
.
ECHO
))
...
...
StackExchange.Redis/StackExchange/Redis/RedisDatabase.cs
View file @
6ed17a99
...
...
@@ -555,13 +555,13 @@ public Task HyperLogLogMergeAsync(RedisKey destination, RedisKey[] sourceKeys, C
public
EndPoint
IdentifyEndpoint
(
RedisKey
key
=
default
(
RedisKey
),
CommandFlags
flags
=
CommandFlags
.
None
)
{
var
msg
=
key
.
IsNull
?
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
)
:
Message
.
Create
(
Database
,
flags
,
RedisCommand
.
EXISTS
,
key
);
var
msg
=
key
.
IsNull
?
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
,
(
RedisValue
)
"pong ident"
)
:
Message
.
Create
(
Database
,
flags
,
RedisCommand
.
EXISTS
,
key
);
return
ExecuteSync
(
msg
,
ResultProcessor
.
ConnectionIdentity
);
}
public
Task
<
EndPoint
>
IdentifyEndpointAsync
(
RedisKey
key
=
default
(
RedisKey
),
CommandFlags
flags
=
CommandFlags
.
None
)
{
var
msg
=
key
.
IsNull
?
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
)
:
Message
.
Create
(
Database
,
flags
,
RedisCommand
.
EXISTS
,
key
);
var
msg
=
key
.
IsNull
?
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
,
(
RedisValue
)
"pong ident"
)
:
Message
.
Create
(
Database
,
flags
,
RedisCommand
.
EXISTS
,
key
);
return
ExecuteAsync
(
msg
,
ResultProcessor
.
ConnectionIdentity
);
}
...
...
StackExchange.Redis/StackExchange/Redis/RedisLiterals.cs
View file @
6ed17a99
...
...
@@ -17,14 +17,21 @@ public static readonly CommandBytes
no
=
"no"
,
OK
=
"OK"
,
one
=
"1"
,
PONG
=
"PONG"
,
QUEUED
=
"QUEUED"
,
READONLY
=
"READONLY "
,
slave_read_only
=
"slave-read-only"
,
timeout
=
"timeout"
,
wildcard
=
"*"
,
yes
=
"yes"
,
zero
=
"0"
;
zero
=
"0"
,
pong_sub
=
"pong sub"
,
pong_hb
=
"pong hb"
,
pong_test
=
"pong test"
,
pong_time
=
"pong time"
,
pong_tran
=
"pong tran"
,
PONG
=
"PONG"
;
}
internal
static
class
RedisLiterals
{
...
...
StackExchange.Redis/StackExchange/Redis/RedisTransaction.cs
View file @
6ed17a99
...
...
@@ -122,8 +122,8 @@ private Message CreateMessage(CommandFlags flags, out ResultProcessor<bool> proc
processor
=
null
;
return
null
;
// they won't notice if we don't do anything...
}
processor
=
ResultProcessor
.
DemandPONG
;
return
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
);
processor
=
ResultProcessor
.
DemandPONG
_TRAN
;
return
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
,
(
RedisValue
)
"pong tran"
);
}
processor
=
TransactionProcessor
.
Default
;
return
new
TransactionMessage
(
Database
,
flags
,
cond
,
work
);
...
...
StackExchange.Redis/StackExchange/Redis/ResultProcessor.cs
View file @
6ed17a99
...
...
@@ -15,7 +15,7 @@ internal abstract class ResultProcessor
public
static
readonly
ResultProcessor
<
bool
>
Boolean
=
new
BooleanProcessor
(),
DemandOK
=
new
ExpectBasicStringProcessor
(
CommonReplies
.
OK
),
DemandPONG
=
new
ExpectBasicStringProcessor
(
CommonReplies
.
PONG
),
DemandPONG
_TRAN
=
new
ExpectBasicStringProcessor
(
CommonReplies
.
pong_tran
),
DemandZeroOrOne
=
new
DemandZeroOrOneProcessor
(),
AutoConfigure
=
new
AutoConfigureProcessor
(),
TrackSubscriptions
=
new
TrackSubscriptionsProcessor
(),
...
...
@@ -1827,10 +1827,13 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
happy
=
result
.
Type
==
ResultType
.
BulkString
&&
(!
establishConnection
||
result
.
IsEqual
(
connection
.
BridgeCouldBeNull
?.
Multiplexer
?.
UniqueId
));
break
;
case
RedisCommand
.
PING
:
// there are two different PINGs; "interactive" is a +PONG or
+
{your message},
// there are two different PINGs; "interactive" is a +PONG or
$
{your message},
// but subscriber returns a bulk-array of [ "pong", {your message} ]
switch
(
result
.
Type
)
{
case
ResultType
.
BulkString
:
happy
=
result
.
IsEqual
(
CommonReplies
.
pong_hb
)
||
result
.
IsEqual
(
CommonReplies
.
pong_test
);
break
;
case
ResultType
.
SimpleString
:
happy
=
result
.
IsEqual
(
CommonReplies
.
PONG
);
break
;
...
...
@@ -1838,7 +1841,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
if
(
result
.
ItemsCount
==
2
)
{
var
items
=
result
.
GetItems
();
happy
=
items
[
0
].
IsEqual
(
CommonReplies
.
PONG
)
&&
items
[
1
].
Payload
.
IsEmpty
;
happy
=
items
[
0
].
IsEqual
(
CommonReplies
.
PONG
)
&&
items
[
1
].
IsEqual
(
CommonReplies
.
pong_sub
)
;
}
else
{
...
...
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
View file @
6ed17a99
...
...
@@ -411,7 +411,7 @@ internal string GetStormLog(RedisCommand command)
return
bridge
?.
GetStormLog
();
}
internal
Message
GetTracerMessage
(
bool
assertIdentity
)
internal
Message
GetTracerMessage
(
bool
assertIdentity
,
string
preferredMessage
)
{
// different configurations block certain commands, as can ad-hoc local configurations, so
// we'll do the best with what we have available.
...
...
@@ -426,7 +426,7 @@ internal Message GetTracerMessage(bool assertIdentity)
}
else
if
(
map
.
IsAvailable
(
RedisCommand
.
PING
))
{
msg
=
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
);
msg
=
Message
.
Create
(-
1
,
flags
,
RedisCommand
.
PING
,
(
RedisValue
)
preferredMessage
);
}
else
if
(
map
.
IsAvailable
(
RedisCommand
.
TIME
))
{
...
...
@@ -586,7 +586,7 @@ internal void ReportNextFailure()
internal
Task
<
bool
>
SendTracer
(
TextWriter
log
=
null
)
{
var
msg
=
GetTracerMessage
(
false
);
var
msg
=
GetTracerMessage
(
false
,
"pong test"
);
msg
=
LoggingMessage
.
Create
(
log
,
msg
);
return
WriteDirectAsync
(
msg
,
ResultProcessor
.
Tracer
);
}
...
...
@@ -704,7 +704,7 @@ private Task HandshakeAsync(PhysicalConnection connection, TextWriter log)
AutoConfigure
(
connection
);
}
Multiplexer
.
LogLocked
(
log
,
"Sending critical tracer: {0}"
,
bridge
);
var
tracer
=
GetTracerMessage
(
true
);
var
tracer
=
GetTracerMessage
(
true
,
"pong test"
);
tracer
=
LoggingMessage
.
Create
(
log
,
tracer
);
WriteDirectOrQueueFireAndForget
(
connection
,
tracer
,
ResultProcessor
.
EstablishConnection
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment