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
03060353
Commit
03060353
authored
Mar 18, 2016
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'piccit-master'
parents
e432b29a
b9d93137
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
Message.cs
StackExchange.Redis/StackExchange/Redis/Message.cs
+12
-7
MessageQueue.cs
StackExchange.Redis/StackExchange/Redis/MessageQueue.cs
+4
-2
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+0
-1
No files found.
StackExchange.Redis/StackExchange/Redis/Message.cs
View file @
03060353
...
...
@@ -6,6 +6,7 @@
using
System.Runtime.Serialization
;
#endif
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
StackExchange.Redis
...
...
@@ -493,15 +494,19 @@ public void SetResponseReceived()
performance
?.
SetResponseReceived
();
}
public
bool
TryComplete
(
bool
isAsync
)
{
if
(
resultBox
!=
null
)
{
var
ret
=
resultBox
.
TryComplete
(
isAsync
);
public
bool
TryComplete
(
bool
isAsync
)
{
//Ensure we can never call TryComplete on the same resultBox from two threads by grabbing it now
var
currBox
=
Interlocked
.
Exchange
(
ref
resultBox
,
null
);
if
(
currBox
!=
null
)
{
var
ret
=
currBox
.
TryComplete
(
isAsync
);
if
(
ret
&&
isAsync
)
//in async mode TryComplete will have unwrapped and recycled resultBox
if
(!(
ret
&&
isAsync
))
{
resultBox
=
null
;
// in async mode TryComplete will have unwrapped and recycled resultBox; ensure we no longer reference it via this message
//put result box back if it was not already recycled
Interlocked
.
Exchange
(
ref
resultBox
,
currBox
);
}
performance
?.
SetCompleted
();
...
...
StackExchange.Redis/StackExchange/Redis/MessageQueue.cs
View file @
03060353
...
...
@@ -35,11 +35,13 @@ public Message PeekPing(out int queueLength)
queueLength
=
high
.
Count
+
regular
.
Count
;
if
(
high
.
Count
!=
0
&&
(
peeked
=
high
.
Peek
()).
Command
==
RedisCommand
.
PING
)
{
return
peeked
;
//In a disconnect scenario, we don't want to complete the Ping message twice,
//dequeue it now so it wont get dequeued in AbortUnsent (if we're going down that code path)
return
high
.
Dequeue
();
}
if
(
regular
.
Count
!=
0
&&
(
peeked
=
regular
.
Peek
()).
Command
==
RedisCommand
.
PING
)
{
return
peeked
;
return
regular
.
Dequeue
()
;
}
}
return
null
;
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
03060353
...
...
@@ -315,7 +315,6 @@ internal void OnDisconnected(ConnectionFailureType failureType, PhysicalConnecti
Trace
(
"OnDisconnected"
);
// if the next thing in the pipe is a PING, we can tell it that we failed (this really helps spot doomed connects)
// note that for simplicity we haven't removed it from the queue; that's OK
int
count
;
var
ping
=
queue
.
PeekPing
(
out
count
);
if
(
ping
!=
null
)
...
...
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