This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<ConnectionContext> AdapterForTls(Task<ConnectionContext> contextTask) | |
{ | |
var provider = new OpenSsl11.OpenSslTlsProvider(); | |
var context = await contextTask; | |
var tlsTransport = await provider.AuthenticateAsServer(context.Transport, new ServerOptions()); | |
context.Transport = tlsTransport; | |
return context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timan@DESKTOP-2NGO9EF C:\code\Leto\openssl | |
> openssl s_client -connect corefx-net-tls.azurewebsites.net:443 -msg | |
CONNECTED(000001B8) | |
>>> ??? [length 0005] | |
16 03 01 00 ef | |
>>> TLS 1.3, Handshake [length 00ef], ClientHello | |
01 00 00 eb 03 03 5f 5a c9 6b 1f 81 98 ce 19 1e | |
3f 65 6a 21 bf 42 f4 60 3a 43 fc a8 c6 c0 1d 93 | |
be 6a 32 62 81 0d 00 00 3e c0 2c c0 30 00 9f cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OperationCache<K,T> | |
{ | |
private Func<K, Task<T>> _operation; | |
private Dictionary<K, Task<T>> _tasks = new Dictionary<K, Task<T>>(); | |
public OperationCache(Func<K, Task<T>> operation) => _operation; | |
// Simple you can now just await on this task | |
// If it is already running, then you will await on it until | |
// it completes (it will only run once) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stack depth 73 | |
EndWrite at offset 168 in file:line:column /home/bench/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs:188:17 | |
<BeginEndWriteAsync>b__55_1 at offset 33 in file:line:column <filename unknown>:0:0 | |
Complete at offset 72 in file:line:column <filename unknown>:0:0 | |
FromAsyncTrim<TInstance,TArgs> at offset 249 in file:line:column <filename unknown>:0:0 | |
BeginEndWriteAsync at offset 394 in file:line:column <filename unknown>:0:0 | |
WriteAsync at offset 41 in file:line:column <filename unknown>:0:0 | |
MoveNext at offset 1264 in file:line:column <filename unknown>:0:0 | |
Run at offset 113 in file:line:column <filename unknown>:0:0 | |
FlushAsync at offset 470 in file:line:column <filename unknown>:0:0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ChildSocketProgram | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
try | |
{ | |
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bench@ubuntudev:~/corefx$ ./build-native.sh | |
Tools are already initialized | |
Running: /home/bench/corefx/src/Native/build-native.sh x64 Debug Linux --numproc 4 -portable toolSetDir=c:\tools\clr | |
Setting up directories for build | |
Checking pre-requisites... | |
Commencing build of corefx native components for Linux.x64.Debug | |
Invoking cmake with arguments: "/home/bench/corefx/src/Native/Unix" DEBUG -DFEATURE_DISTRO_AGNOSTIC_SSL=1 -DCMAKE_STATIC_LIB_LINK=0 | |
-- The C compiler identification is Clang 3.5.0 | |
-- The CXX compiler identification is Clang 3.5.0 | |
-- Check for working C compiler: /usr/bin/clang-3.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tools are already initialized | |
Running: /home/bench/corefx/src/Native/build-native.sh x64 Debug Linux --numproc 4 -portable toolSetDir=c:\tools\clr | |
Setting up directories for build | |
Checking pre-requisites... | |
Commencing build of corefx native components for Linux.x64.Debug | |
Invoking cmake with arguments: "/home/bench/corefx/src/Native/Unix" DEBUG -DFEATURE_DISTRO_AGNOSTIC_SSL=1 -DCMAKE_STATIC_LIB_LINK=0 | |
-- The C compiler identification is Clang 3.5.0 | |
-- The CXX compiler identification is Clang 3.5.0 | |
-- Check for working C compiler: /usr/bin/clang-3.5 | |
-- Check for working C compiler: /usr/bin/clang-3.5 -- works |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyAuthenticationMiddleware : AuthenticationMiddleware<MyAuthenticationOptions> | |
{ | |
public MyAuthenticationMiddleware( | |
IMyService myService, // inject service here?? (via Startup.ConfigureServices(), services.AddTransient() ) | |
RequestDelegate next, | |
IOptions<MyAuthenticationOptions> options, | |
ILoggerFactory loggerFactory, | |
UrlEncoder encoder) | |
: base(next, options, loggerFactory, encoder) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace ConsoleApp2 | |
{ | |
public class ReloadingCache:IDisposable | |
{ | |
private List<string> _cachedItems; | |
private System.Threading.Timer _timer; | |
private System.Threading.Mutex _mutex = new System.Threading.Mutex(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
public class ReloadingCache | |
{ | |
private List<string> _cachedItems; | |
private System.Threading.Timer _timer; | |
public ReloadingCache() | |
{ | |
//Load the first lot of data to stop consumers getting null |