Permalink
Browse files

Implements correct canceling of app when client closes connection. Fi…

…xes #39.
  • Loading branch information...
1 parent 98c11b2 commit b0ff5ecd0a785ef601a65b62db67243c62b02a42 @Bobris committed Sep 19, 2015
@@ -3,7 +3,7 @@
namespace Nowin
{
- internal struct ChunkedDecoder
+ struct ChunkedDecoder
{
long _dataAvail;
long _nextAvail;
@@ -1,6 +1,6 @@
namespace Nowin
{
- internal class ConnectionBlock
+ class ConnectionBlock
{
readonly Server _server;
readonly int _connectionCount;
@@ -1,6 +1,6 @@
namespace System.Collections.Generic
{
- internal static class DictionaryExtensions
+ static class DictionaryExtensions
{
internal static T Get<T>(this IDictionary<string, object> dictionary, string key)
{
@@ -20,18 +20,18 @@ public static Func<IDisposable> CreateContextSuppresser(ExecutionContextFlow con
case ExecutionContextFlow.Flow:
return _flow;
default:
- throw new ArgumentOutOfRangeException("contextFlow");
+ throw new ArgumentOutOfRangeException(nameof(contextFlow));
}
}
- private static IDisposable SuppressAlways()
+ static IDisposable SuppressAlways()
{
if (!ExecutionContext.IsFlowSuppressed())
ExecutionContext.SuppressFlow();
return NullDisposable.Instance;
}
- private static IDisposable SuppressOnAsync()
+ static IDisposable SuppressOnAsync()
{
return ExecutionContext.IsFlowSuppressed()
? NullDisposable.Instance
@@ -7,7 +7,7 @@
namespace Nowin
{
- internal interface IServerParameters
+ interface IServerParameters
{
ExecutionContextFlow ContextFlow { get; }
IConnectionAllocationStrategy ConnectionAllocationStrategy { get; }
@@ -78,7 +78,7 @@ void ReadSyncPart(byte[] buffer, int offset, int count)
Task<int> ReadOverflowAsync()
{
_tcs = new TaskCompletionSource<int>();
- _transport2HttpHandler.StartNextReceive();
+ _transport2HttpHandler.StartNextRequestDataReceive();
return _tcs.Task;
}
@@ -66,7 +66,7 @@ void RecreateSaeas()
_disconnectEvent.UserToken = this;
}
- private void DisposeEventArgs()
+ void DisposeEventArgs()
{
if (_receiveEvent != null)
{
@@ -296,10 +296,10 @@ public void StartSend(byte[] buffer, int offset, int length)
throw new InvalidOperationException("Already sending");
newState = oldState | (int)State.Send;
} while (Interlocked.CompareExchange(ref _state, newState, oldState) != oldState);
- _sendEvent.SetBuffer(buffer, offset, length);
bool willRaiseEvent;
try
{
+ _sendEvent.SetBuffer(buffer, offset, length);
using (StopExecutionContextFlow())
willRaiseEvent = _socket.SendAsync(_sendEvent);
}
View
@@ -110,92 +110,14 @@ internal class DebugTraceSource : TraceSource
<trace autoflush="true" indentsize="0">
<listeners>
- <remove name="Default"/>
<add name="Global"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="Global.log" />
- <!-- Critical, Error, Warning, Information, Verbose -->
- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning"/>
+ type="System.Diagnostics.TextWriterTraceListener"
+ initializeData="Global.log">
</add>
</listeners>
</trace>
<sources>
- <source name="SignalR.SqlMessageBus">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Bus" />
- </listeners>
- </source>
- <source name="SignalR.ServiceBusMessageBus">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Bus" />
- </listeners>
- </source>
- <source name="SignalR.ScaleoutMessageBus">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Bus" />
- </listeners>
- </source>
-
- <source name="SignalR.Transports.WebSocketTransport">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Transports" />
- </listeners>
- </source>
- <source name="SignalR.Transports.ServerSentEventsTransport">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Transports" />
- </listeners>
- </source>
- <source name="SignalR.Transports.ForeverFrameTransport">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Transports" />
- </listeners>
- </source>
- <source name="SignalR.Transports.LongPollingTransport">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Transports" />
- </listeners>
- </source>
- <source name="SignalR.Transports.TransportHeartBeat">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Transports" />
- </listeners>
- </source>
-
- <source name="SignalR.HubDispatcher">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.HubDispatcher" />
- </listeners>
- </source>
- <source name="SignalR.Connection">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.Connection" />
- </listeners>
- </source>
- <source name="SignalR.PerformanceCounterManager">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.PerformanceCounterManager" />
- </listeners>
- </source>
- <source name="SignalR.PersistentConnection">
- <listeners>
- <remove name="Default"/>
- <add name="SignalR.PersistentConnection" />
- </listeners>
- </source>
-
<source name="Nowin.Core">
<listeners>
<remove name="Default"/>
@@ -211,35 +133,13 @@ internal class DebugTraceSource : TraceSource
</sources>
<switches>
- <add name="SignalRSwitch" value="Verbose" />
<add name="Nowin.Core" value="Verbose" />
<add name="Nowin.Core.Debug" value="Verbose" />
</switches>
<sharedListeners>
- <add name="SignalR.Bus"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="SignalR.Bus.log" />
-
- <add name="SignalR.Transports"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="SignalR.Transports.log" />
-
- <add name="SignalR.HubDispatcher"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="SignalR.HubDispatcher.log" />
- <add name="SignalR.Connection"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="SignalR.Connection.log" />
- <add name="SignalR.PerformanceCounterManager"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="SignalR.PerformanceCounterManager.log" />
- <add name="SignalR.PersistentConnection"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="SignalR.PersistentConnection.log" />
-
<add name="Nowin.Core"
- type="System.Diagnostics.TextWriterTraceListener"
+ type="System.Diagnostics.TextWriterTraceListener"
initializeData="Nowin.Core.log" />
</sharedListeners>
Oops, something went wrong.

0 comments on commit b0ff5ec

Please sign in to comment.