[Modify] Remove it
This commit is contained in:
parent
0958cef33a
commit
2dd3fa139d
@ -554,100 +554,6 @@ namespace WebSocketSharp.Server
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the data from <paramref name="stream"/> asynchronously to
|
||||
/// every client in the WebSocket services.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The data is sent as the binary data.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This method does not wait for the send to be complete.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="stream">
|
||||
/// A <see cref="Stream"/> instance from which to read the data to send.
|
||||
/// </param>
|
||||
/// <param name="length">
|
||||
/// An <see cref="int"/> that specifies the number of bytes to send.
|
||||
/// </param>
|
||||
/// <param name="completed">
|
||||
/// <para>
|
||||
/// An <see cref="Action"/> delegate or <see langword="null"/>
|
||||
/// if not needed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The delegate invokes the method called when the send is complete.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// The current state of the manager is not Start.
|
||||
/// </exception>
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// <paramref name="stream"/> is <see langword="null"/>.
|
||||
/// </exception>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// <para>
|
||||
/// <paramref name="stream"/> cannot be read.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// -or-
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <paramref name="length"/> is less than 1.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// -or-
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// No data could be read from <paramref name="stream"/>.
|
||||
/// </para>
|
||||
/// </exception>
|
||||
[Obsolete ("This method will be removed.")]
|
||||
public void BroadcastAsync (Stream stream, int length, Action completed)
|
||||
{
|
||||
if (_state != ServerState.Start) {
|
||||
var msg = "The current state of the manager is not Start.";
|
||||
throw new InvalidOperationException (msg);
|
||||
}
|
||||
|
||||
if (stream == null)
|
||||
throw new ArgumentNullException ("stream");
|
||||
|
||||
if (!stream.CanRead) {
|
||||
var msg = "It cannot be read.";
|
||||
throw new ArgumentException (msg, "stream");
|
||||
}
|
||||
|
||||
if (length < 1) {
|
||||
var msg = "Less than 1.";
|
||||
throw new ArgumentException (msg, "length");
|
||||
}
|
||||
|
||||
var bytes = stream.ReadBytes (length);
|
||||
|
||||
var len = bytes.Length;
|
||||
if (len == 0) {
|
||||
var msg = "No data could be read from it.";
|
||||
throw new ArgumentException (msg, "stream");
|
||||
}
|
||||
|
||||
if (len < length) {
|
||||
_log.Warn (
|
||||
String.Format (
|
||||
"Only {0} byte(s) of data could be read from the stream.",
|
||||
len
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (len <= WebSocket.FragmentLength)
|
||||
broadcastAsync (Opcode.Binary, bytes, completed);
|
||||
else
|
||||
broadcastAsync (Opcode.Binary, new MemoryStream (bytes), completed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a ping to every client in the WebSocket services.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user