wasSharpNET – Diff between revs 10 and 11

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 10 Rev 11
Line 12... Line 12...
12 namespace wasSharpNET.Network.HTTP 12 namespace wasSharpNET.Network.HTTP
13 { 13 {
14 public abstract class HTTPServer 14 public abstract class HTTPServer
15 { 15 {
16 private int activeRequests; 16 private int activeRequests;
-   17  
17 private readonly HttpListener HTTPListener = new HttpListener() 18 private readonly HttpListener HTTPListener = new HttpListener()
18 { 19 {
19 AuthenticationSchemes = AuthenticationSchemes.None 20 AuthenticationSchemes = AuthenticationSchemes.None
20 }; 21 };
-   22  
21 private int processedRequests; 23 private int processedRequests;
Line 22... Line 24...
22   24  
23 private readonly AutoResetEvent StopServerEvent = new AutoResetEvent(false); 25 private readonly AutoResetEvent StopServerEvent = new AutoResetEvent(false);
Line 64... Line 66...
64 return true; 66 return true;
65 } 67 }
Line 66... Line 68...
66   68  
67 private void Listen(object state) 69 private void Listen(object state)
68 { 70 {
Line 69... Line 71...
69 var callbackState = (HTTPServerCallbackState) state; 71 var callbackState = (HTTPServerCallbackState)state;
70   72  
71 while (callbackState.Listener.IsListening) 73 while (callbackState.Listener.IsListening)
72 { 74 {
Line 73... Line 75...
73 callbackState.Listener.BeginGetContext(ContextCallback, callbackState); 75 callbackState.Listener.BeginGetContext(ContextCallback, callbackState);
74 var n = WaitHandle.WaitAny(new WaitHandle[] {callbackState.ContextRetrieved, StopServerEvent}); 76 var n = WaitHandle.WaitAny(new WaitHandle[] { callbackState.ContextRetrieved, StopServerEvent });
75   77  
76 if (n.Equals(1)) 78 if (n.Equals(1))
Line 85... Line 87...
85   87  
Line 86... Line 88...
86 public abstract void ProcessHTTPContext(HttpListenerContext context); 88 public abstract void ProcessHTTPContext(HttpListenerContext context);
87   89  
88 private void ContextCallback(IAsyncResult ar) 90 private void ContextCallback(IAsyncResult ar)
89 { 91 {
Line 90... Line 92...
90 var callbackState = (HTTPServerCallbackState) ar.AsyncState; 92 var callbackState = (HTTPServerCallbackState)ar.AsyncState;
91 HttpListenerContext httpContext = null; 93 HttpListenerContext httpContext = null;
Line 133... Line 135...
133 public HttpListener Listener { get; } 135 public HttpListener Listener { get; }
Line 134... Line 136...
134   136  
135 public AutoResetEvent ContextRetrieved { get; } 137 public AutoResetEvent ContextRetrieved { get; }
136 } 138 }
137 } -  
138 } 139 }
-   140 }