@@ -53,8 +53,12 @@ public void Start()
53
53
_scheduler . Start ( ) ;
54
54
}
55
55
56
- private async void ProcessInputStream ( )
56
+ // don't be async: We already allocated a seperate thread for this.
57
+ private void ProcessInputStream ( )
57
58
{
59
+ // some time to attach a debugger
60
+ // System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
61
+
58
62
// header is encoded in ASCII
59
63
// "Content-Length: 0" counts bytes for the following content
60
64
// content is encoded in UTF-8
@@ -63,13 +67,13 @@ private async void ProcessInputStream()
63
67
if ( _inputThread == null ) return ;
64
68
65
69
var buffer = new byte [ 300 ] ;
66
- var current = await _input . ReadAsync ( buffer , 0 , MinBuffer ) ;
70
+ var current = _input . Read ( buffer , 0 , MinBuffer ) ;
67
71
if ( current == 0 ) return ; // no more _input
68
72
while ( current < MinBuffer ||
69
73
buffer [ current - 4 ] != CR || buffer [ current - 3 ] != LF ||
70
74
buffer [ current - 2 ] != CR || buffer [ current - 1 ] != LF )
71
75
{
72
- var n = await _input . ReadAsync ( buffer , current , 1 ) ;
76
+ var n = _input . Read ( buffer , current , 1 ) ;
73
77
if ( n == 0 ) return ; // no more _input, mitigates endless loop here.
74
78
current += n ;
75
79
}
@@ -99,7 +103,7 @@ private async void ProcessInputStream()
99
103
var received = 0 ;
100
104
while ( received < length )
101
105
{
102
- var n = await _input . ReadAsync ( requestBuffer , received , requestBuffer . Length - received ) ;
106
+ var n = _input . Read ( requestBuffer , received , requestBuffer . Length - received ) ;
103
107
if ( n == 0 ) return ; // no more _input
104
108
received += n ;
105
109
}
0 commit comments