[Modify] Polish it
This commit is contained in:
		| @@ -250,13 +250,23 @@ namespace WebSocketSharp.Server | |||||||
|     private void broadcast (Opcode opcode, byte[] data, Action completed) |     private void broadcast (Opcode opcode, byte[] data, Action completed) | ||||||
|     { |     { | ||||||
|       var cache = new Dictionary<CompressionMethod, byte[]> (); |       var cache = new Dictionary<CompressionMethod, byte[]> (); | ||||||
|  |  | ||||||
|       try { |       try { | ||||||
|         Broadcast (opcode, data, cache); |         foreach (var session in Sessions) { | ||||||
|  |           if (_state != ServerState.Start) { | ||||||
|  |             _log.Error ("The service is shutting down."); | ||||||
|  |             break; | ||||||
|  |           } | ||||||
|  |  | ||||||
|  |           session.Context.WebSocket.Send (opcode, data, cache); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         if (completed != null) |         if (completed != null) | ||||||
|           completed (); |           completed (); | ||||||
|       } |       } | ||||||
|       catch (Exception ex) { |       catch (Exception ex) { | ||||||
|         _log.Fatal (ex.ToString ()); |         _log.Error (ex.Message); | ||||||
|  |         _log.Debug (ex.ToString ()); | ||||||
|       } |       } | ||||||
|       finally { |       finally { | ||||||
|         cache.Clear (); |         cache.Clear (); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user