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
6eb9ee9b
Commit
6eb9ee9b
authored
Mar 15, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error message when a connection fails
parent
5214df34
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
.hgignore
.hgignore
+1
-0
ConnectionFailureType.cs
...change.Redis/StackExchange/Redis/ConnectionFailureType.cs
+1
-1
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+8
-2
No files found.
.hgignore
View file @
6eb9ee9b
syntax: glob
*/bin/
.git
*/obj/
Tests/bin/
Tests/obj/
...
...
StackExchange.Redis/StackExchange/Redis/ConnectionFailureType.cs
View file @
6eb9ee9b
...
...
@@ -36,6 +36,6 @@ public enum ConnectionFailureType
/// <summary>
/// The socket was closed
/// </summary>
ConnectionDisposed
ConnectionDisposed
,
}
}
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
6eb9ee9b
...
...
@@ -129,10 +129,11 @@ public void Dispose()
}
OnCloseEcho
();
}
long
lastWriteTickCount
,
lastReadTickCount
;
public
void
Flush
()
{
outStream
.
Flush
();
Interlocked
.
Exchange
(
ref
lastWriteTickCount
,
Environment
.
TickCount
);
}
int
failureReported
;
public
void
RecordConnectionFailed
(
ConnectionFailureType
failureType
,
Exception
innerException
=
null
)
...
...
@@ -146,7 +147,11 @@ public void RecordConnectionFailed(ConnectionFailureType failureType, Exception
{
try
{
string
message
=
failureType
+
" on "
+
Format
.
ToString
(
bridge
.
ServerEndPoint
.
EndPoint
)
+
"/"
+
connectionType
;
long
now
=
Environment
.
TickCount
,
lastRead
=
Interlocked
.
Read
(
ref
lastReadTickCount
),
lastWrite
=
Interlocked
.
Read
(
ref
lastWriteTickCount
);
string
message
=
failureType
+
" on "
+
Format
.
ToString
(
bridge
.
ServerEndPoint
.
EndPoint
)
+
"/"
+
connectionType
+
", input-butter: "
+
ioBufferBytes
+
", outstanding: "
+
GetOutstandingCount
()
+
", last-read: "
+
(
now
-
lastRead
)
/
1000
+
"s ago, last-write"
+
(
now
-
lastWrite
)
/
1000
+
"s ago"
;
var
ex
=
innerException
==
null
?
new
RedisConnectionException
(
failureType
,
message
)
:
new
RedisConnectionException
(
failureType
,
message
,
innerException
);
...
...
@@ -623,6 +628,7 @@ private void ProcessBytes(int bytesRead)
}
else
{
Interlocked
.
Exchange
(
ref
lastReadTickCount
,
Environment
.
TickCount
);
ioBufferBytes
+=
bytesRead
;
multiplexer
.
Trace
(
"More bytes available: "
+
bytesRead
+
" ("
+
ioBufferBytes
+
")"
,
physicalName
);
int
offset
=
0
,
count
=
ioBufferBytes
;
...
...
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