Skip to content

Commit

Permalink
v3.6.2 #288 #287
Browse files Browse the repository at this point in the history
  • Loading branch information
28810 authored and 28810 committed Apr 14, 2020
1 parent e46e87b commit 1796942
Show file tree
Hide file tree
Showing 68 changed files with 839 additions and 31 deletions.
16 changes: 11 additions & 5 deletions csredis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Help", "Help", "{A5960636-4
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSRedisCore", "src\CSRedisCore.csproj", "{E72D0C8D-66B4-4466-B700-730EAED30285}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSRedisCore", "src\CSRedisCore\CSRedisCore.csproj", "{75C241B2-F18A-4F2E-8C17-80799DFFAAC3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Caching.CSRedis", "src\Microsoft.Extensions.Caching.CSRedis\Microsoft.Extensions.Caching.CSRedis.csproj", "{D80EFF1F-91CF-4D22-B36E-3E345A41C05E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -22,10 +24,14 @@ Global
{70B1F8DC-C245-421E-866D-3F4149692F69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70B1F8DC-C245-421E-866D-3F4149692F69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70B1F8DC-C245-421E-866D-3F4149692F69}.Release|Any CPU.Build.0 = Release|Any CPU
{E72D0C8D-66B4-4466-B700-730EAED30285}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E72D0C8D-66B4-4466-B700-730EAED30285}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E72D0C8D-66B4-4466-B700-730EAED30285}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E72D0C8D-66B4-4466-B700-730EAED30285}.Release|Any CPU.Build.0 = Release|Any CPU
{75C241B2-F18A-4F2E-8C17-80799DFFAAC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75C241B2-F18A-4F2E-8C17-80799DFFAAC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75C241B2-F18A-4F2E-8C17-80799DFFAAC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75C241B2-F18A-4F2E-8C17-80799DFFAAC3}.Release|Any CPU.Build.0 = Release|Any CPU
{D80EFF1F-91CF-4D22-B36E-3E345A41C05E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D80EFF1F-91CF-4D22-B36E-3E345A41C05E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D80EFF1F-91CF-4D22-B36E-3E345A41C05E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D80EFF1F-91CF-4D22-B36E-3E345A41C05E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AssemblyName>CSRedisCore</AssemblyName>
<PackageId>CSRedisCore</PackageId>
<RootNamespace>CSRedisCore</RootNamespace>
<Version>3.6.1</Version>
<Version>3.6.2</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/2881099/csredis</PackageProjectUrl>
<Description>CSRedis 是 redis.io 官方推荐库,支持 redis-trib集群、哨兵、私有分区与连接池管理技术,简易 RedisHelper 静态类。</Description>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public RedisIO()
public void SetStream(Stream stream)
{
if (_stream != null)
_stream.Dispose();
{
try { _stream.Close(); } catch { }
try { _stream.Dispose(); } catch { }
}

_stream = stream;
_reader = new RedisReader(this);
Expand All @@ -43,39 +46,47 @@ public void SetStream(Stream stream)

#if net40
#else
public Task<int> WriteAsync(RedisCommand command)
async public Task<int> WriteAsync(RedisCommand command)
{
var data = _writer.Prepare(command);

var tcs = new TaskCompletionSource<int>();
lock (_streamLock)
{
Stream.BeginWrite(data, 0, data.Length, asyncResult =>
{
try
{
_stream.EndWrite(asyncResult);
tcs.TrySetResult(data.Length);
}
catch (Exception ex)
{
tcs.TrySetException(ex);
}
}, null);
}
return tcs.Task;
await Stream.WriteAsync(data, 0, data.Length);
return data.Length;
//var tcs = new TaskCompletionSource<int>();
//lock (_streamLock)
//{
// Stream.BeginWrite(data, 0, data.Length, asyncResult =>
// {
// try
// {
// _stream.EndWrite(asyncResult);
// tcs.TrySetResult(data.Length);
// }
// catch (Exception ex)
// {
// tcs.TrySetException(ex);
// }
// }, null);
// Stream.Flush();
//}
//return tcs.Task;
}
#endif

public void Write(byte[] data)
{
lock (_streamLock)
{
Stream.Write(data, 0, data.Length);
Stream.Flush();
}
}
public void Write(Stream stream)
{
lock (_streamLock)
{
stream.CopyTo(Stream);
Stream.Flush();
}
}
public int ReadByte()
{
Expand Down Expand Up @@ -138,12 +149,11 @@ public Byte[] ReadAll()

public void Dispose()
{
if (_pipeline != null)
_pipeline.Dispose();
if (_pipeline != null) _pipeline.Dispose();
if (_stream != null)
{
try { _stream.Close(); } catch { }
_stream.Dispose();
try { _stream.Dispose(); } catch { }
}
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Task<bool> ConnectAsync(EndPoint endpoint)

public Stream GetStream()
{
Stream netStream = new NetworkStream(_socket);
Stream netStream = new NetworkStream(_socket, true);

if (!_ssl) return netStream;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions src/Microsoft.Extensions.Caching.CSRedis/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
Loading

0 comments on commit 1796942

Please sign in to comment.