mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
Stability improvement:
Processing in separate threat may cause racing condition and timeouts in browser. By putting processing in original threat we get a more sequential processing and more stability.
This commit is contained in:
parent
14210f3654
commit
8dde236256
@ -4,7 +4,9 @@ using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
// offered to the public domain for any use with no restriction
|
||||
@ -57,10 +59,8 @@ namespace SpotifyAPI.Web
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Process(object tcpClient)
|
||||
public void Process(TcpClient socket)
|
||||
{
|
||||
TcpClient socket = tcpClient as TcpClient;
|
||||
|
||||
// we can't use a StreamReader for input, because it buffers up extra data on us inside it's
|
||||
// "processed" view of the world, and we want the data raw after the headers
|
||||
_inputStream = new BufferedStream(socket.GetStream());
|
||||
@ -80,7 +80,7 @@ namespace SpotifyAPI.Web
|
||||
HandlePostRequest();
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteFailure();
|
||||
}
|
||||
@ -224,9 +224,7 @@ namespace SpotifyAPI.Web
|
||||
while (IsActive)
|
||||
{
|
||||
TcpClient s = _listener.AcceptTcpClient();
|
||||
Thread thread = new Thread(processor.Process);
|
||||
thread.Start(s);
|
||||
Thread.Sleep(1);
|
||||
processor.Process(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user