Updated task methods.

Instead of awaiting most tasks, changed to simply returning the tasks.
This commit is contained in:
Zazzmatazz
2017-06-02 16:20:48 -04:00
parent 2db289a658
commit 5c1eceb8a9
7 changed files with 52 additions and 55 deletions
@@ -77,14 +77,14 @@ namespace MQTTnet
/// Asynchronously writes a sequence of bytes to the socket.
/// </summary>
/// <param name="buffer">The buffer to write data from.</param>
public async Task WriteAsync(byte[] buffer)
public Task WriteAsync(byte[] buffer)
{
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
try
{
await _sslStream.WriteAsync(buffer, 0, buffer.Length);
return _sslStream.WriteAsync(buffer, 0, buffer.Length);
}
catch (Exception ex)
when (ex is SocketException || ex is IOException)
@@ -97,11 +97,11 @@ namespace MQTTnet
/// Asynchronously reads a sequence of bytes from the socket.
/// </summary>
/// <param name="buffer">The buffer to write the data into.</param>
public async Task ReadAsync(byte[] buffer)
public Task ReadAsync(byte[] buffer)
{
try
{
await _sslStream.ReadAsync(buffer, 0, buffer.Length);
return _sslStream.ReadAsync(buffer, 0, buffer.Length);
}
catch (Exception ex)
when (ex is SocketException || ex is IOException)