protected override Task Send(IList<Message> messages) { if (messages == null || messages.Count == 0) { var emptyTask = new TaskCompletionSource<object>(); emptyTask.SetResult(null); return emptyTask.Task; } if (_connection.State == ConnectionState.Disconnected) { startTask = _connection.Start(); startTask.ContinueWith(t => { throw t.Exception.GetBaseException(); }, TaskContinuationOptions.OnlyOnFaulted); } if (!startTask.IsCompleted) { startTask.Wait(); } return _connection.Send("s:"+messages.ToScaleoutString()); }
protected override Task Send(IList<Message> messages) { if (messages == null || messages.Count == 0 || _connection.State != ConnectionState.Connected) { return makeEmptyTask(); } return _connection.Send("s:" + messages.ToScaleoutString()); }