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
2c307067
Commit
2c307067
authored
Aug 08, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DebugAids: move SimulateConnectionFailure to internal
parent
63c80596
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
37 deletions
+37
-37
DebuggingAids.cs
StackExchange.Redis/StackExchange/Redis/DebuggingAids.cs
+0
-35
IServer.cs
...kExchange.Redis/StackExchange/Redis/Interfaces/IServer.cs
+9
-0
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+13
-1
RedisServer.cs
StackExchange.Redis/StackExchange/Redis/RedisServer.cs
+6
-1
ServerEndPoint.cs
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
+9
-0
No files found.
StackExchange.Redis/StackExchange/Redis/DebuggingAids.cs
View file @
2c307067
...
...
@@ -5,29 +5,6 @@
namespace
StackExchange.Redis
{
#if DEBUG
public
partial
interface
IServer
{
/// <summary>
/// Break the connection without mercy or thought
/// </summary>
void
SimulateConnectionFailure
();
}
internal
partial
class
ServerEndPoint
{
internal
void
SimulateConnectionFailure
()
{
interactive
?.
SimulateConnectionFailure
();
subscription
?.
SimulateConnectionFailure
();
}
}
internal
partial
class
RedisServer
{
void
IServer
.
SimulateConnectionFailure
()
=>
server
.
SimulateConnectionFailure
();
}
public
partial
class
ConnectionMultiplexer
{
private
volatile
bool
allowConnect
=
true
,
...
...
@@ -44,18 +21,6 @@ public partial class ConnectionMultiplexer
public
bool
IgnoreConnect
{
get
{
return
ignoreConnect
;
}
set
{
ignoreConnect
=
value
;
}
}
}
internal
partial
class
PhysicalBridge
{
internal
void
SimulateConnectionFailure
()
{
if
(!
Multiplexer
.
RawConfig
.
AllowAdmin
)
{
throw
ExceptionFactory
.
AdminModeNotEnabled
(
Multiplexer
.
IncludeDetailInExceptions
,
RedisCommand
.
DEBUG
,
null
,
ServerEndPoint
);
// close enough
}
physical
?.
RecordConnectionFailed
(
ConnectionFailureType
.
SocketFailure
);
}
}
internal
partial
class
PhysicalConnection
{
partial
void
ShouldIgnoreConnect
(
ref
bool
ignore
)
...
...
StackExchange.Redis/StackExchange/Redis/Interfaces/IServer.cs
View file @
2c307067
...
...
@@ -717,4 +717,13 @@ public partial interface IServer : IRedis
#
endregion
}
internal
static
class
IServerExtensions
{
/// <summary>
/// For testing only: Break the connection without mercy or thought
/// </summary>
/// <param name="server">The server to simulate failure on.</param>
public
static
void
SimulateConnectionFailure
(
this
IServer
server
)
=>
(
server
as
RedisServer
)?.
SimulateConnectionFailure
();
}
}
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
2c307067
...
...
@@ -9,7 +9,7 @@
namespace
StackExchange.Redis
{
internal
sealed
partial
class
PhysicalBridge
:
IDisposable
internal
sealed
class
PhysicalBridge
:
IDisposable
{
internal
readonly
string
Name
;
...
...
@@ -799,5 +799,17 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne
return
WriteResult
.
WriteFailure
;
}
}
/// <summary>
/// For testing only
/// </summary>
internal
void
SimulateConnectionFailure
()
{
if
(!
Multiplexer
.
RawConfig
.
AllowAdmin
)
{
throw
ExceptionFactory
.
AdminModeNotEnabled
(
Multiplexer
.
IncludeDetailInExceptions
,
RedisCommand
.
DEBUG
,
null
,
ServerEndPoint
);
// close enough
}
physical
?.
RecordConnectionFailed
(
ConnectionFailureType
.
SocketFailure
);
}
}
}
StackExchange.Redis/StackExchange/Redis/RedisServer.cs
View file @
2c307067
...
...
@@ -9,7 +9,7 @@
namespace
StackExchange.Redis
{
internal
sealed
partial
class
RedisServer
:
RedisBase
,
IServer
internal
sealed
class
RedisServer
:
RedisBase
,
IServer
{
private
readonly
ServerEndPoint
server
;
...
...
@@ -841,5 +841,10 @@ public Task<RedisResult> ExecuteAsync(string command, ICollection<object> args,
}
#
endregion
/// <summary>
/// For testing only
/// </summary>
internal
void
SimulateConnectionFailure
()
=>
server
.
SimulateConnectionFailure
();
}
}
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
View file @
2c307067
...
...
@@ -732,5 +732,14 @@ private void SetConfig<T>(ref T field, T value, [CallerMemberName] string caller
Multiplexer
.
ReconfigureIfNeeded
(
EndPoint
,
false
,
caller
);
}
}
/// <summary>
/// For testing only
/// </summary>
internal
void
SimulateConnectionFailure
()
{
interactive
?.
SimulateConnectionFailure
();
subscription
?.
SimulateConnectionFailure
();
}
}
}
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