[Modify] Polish it

This commit is contained in:
sta 2017-08-26 21:30:57 +09:00
parent dc96030716
commit 4c8301cd9c

View File

@ -276,13 +276,23 @@ namespace WebSocketSharp.Server
private void broadcast (Opcode opcode, Stream stream, Action completed)
{
var cache = new Dictionary <CompressionMethod, Stream> ();
try {
Broadcast (opcode, stream, cache);
foreach (var session in Sessions) {
if (_state != ServerState.Start) {
_log.Error ("The service is shutting down.");
break;
}
session.Context.WebSocket.Send (opcode, stream, cache);
}
if (completed != null)
completed ();
}
catch (Exception ex) {
_log.Fatal (ex.ToString ());
_log.Error (ex.Message);
_log.Debug (ex.ToString ());
}
finally {
foreach (var cached in cache.Values)