@@ -51,12 +51,13 @@ private async ValueTask EnsureStreamSetup()
51
51
if ( _streamProvider is not null )
52
52
return ;
53
53
54
- await _streamSetupLock . WaitAsync ( ) ;
55
-
56
- if ( _streamProvider is not null )
57
- return ;
58
54
try
59
55
{
56
+ await _streamSetupLock . WaitAsync ( ) ;
57
+
58
+ if ( _streamProvider is not null )
59
+ return ;
60
+
60
61
await SetupStreams ( ) ;
61
62
}
62
63
finally
@@ -153,22 +154,22 @@ public override async Task OnDisconnectedAsync(HubConnectionContext connection)
153
154
}
154
155
}
155
156
156
- public override Task SendAllAsync ( string methodName , object ? [ ] ? args ,
157
+ public override Task SendAllAsync ( string methodName , object ? [ ] args ,
157
158
CancellationToken cancellationToken = new CancellationToken ( ) )
158
159
{
159
160
var message = new InvocationMessage ( methodName , args ) ;
160
161
return _allStream . OnNextAsync ( new AllMessage ( message ) ) ;
161
162
}
162
163
163
- public override Task SendAllExceptAsync ( string methodName , object ? [ ] ? args ,
164
+ public override Task SendAllExceptAsync ( string methodName , object ? [ ] args ,
164
165
IReadOnlyList < string > excludedConnectionIds ,
165
166
CancellationToken cancellationToken = new CancellationToken ( ) )
166
167
{
167
168
var message = new InvocationMessage ( methodName , args ) ;
168
169
return _allStream . OnNextAsync ( new AllMessage ( message , excludedConnectionIds ) ) ;
169
170
}
170
171
171
- public override Task SendConnectionAsync ( string connectionId , string methodName , object ? [ ] ? args ,
172
+ public override Task SendConnectionAsync ( string connectionId , string methodName , object ? [ ] args ,
172
173
CancellationToken cancellationToken = new CancellationToken ( ) )
173
174
{
174
175
if ( string . IsNullOrWhiteSpace ( connectionId ) ) throw new ArgumentNullException ( nameof ( connectionId ) ) ;
@@ -182,14 +183,14 @@ public override Task SendConnectionAsync(string connectionId, string methodName,
182
183
return SendExternal ( connectionId , message ) ;
183
184
}
184
185
185
- public override Task SendConnectionsAsync ( IReadOnlyList < string > connectionIds , string methodName , object ? [ ] ? args ,
186
+ public override Task SendConnectionsAsync ( IReadOnlyList < string > connectionIds , string methodName , object ? [ ] args ,
186
187
CancellationToken cancellationToken = new CancellationToken ( ) )
187
188
{
188
189
var tasks = connectionIds . Select ( c => SendConnectionAsync ( c , methodName , args , cancellationToken ) ) ;
189
190
return Task . WhenAll ( tasks ) ;
190
191
}
191
192
192
- public override Task SendGroupAsync ( string groupName , string methodName , object ? [ ] ? args ,
193
+ public override Task SendGroupAsync ( string groupName , string methodName , object ? [ ] args ,
193
194
CancellationToken cancellationToken = new CancellationToken ( ) )
194
195
{
195
196
if ( string . IsNullOrWhiteSpace ( groupName ) ) throw new ArgumentNullException ( nameof ( groupName ) ) ;
@@ -199,14 +200,14 @@ public override Task SendGroupAsync(string groupName, string methodName, object?
199
200
return group . Send ( methodName , args ) ;
200
201
}
201
202
202
- public override Task SendGroupsAsync ( IReadOnlyList < string > groupNames , string methodName , object ? [ ] ? args ,
203
+ public override Task SendGroupsAsync ( IReadOnlyList < string > groupNames , string methodName , object ? [ ] args ,
203
204
CancellationToken cancellationToken = new CancellationToken ( ) )
204
205
{
205
206
var tasks = groupNames . Select ( g => SendGroupAsync ( g , methodName , args , cancellationToken ) ) ;
206
207
return Task . WhenAll ( tasks ) ;
207
208
}
208
209
209
- public override Task SendGroupExceptAsync ( string groupName , string methodName , object ? [ ] ? args ,
210
+ public override Task SendGroupExceptAsync ( string groupName , string methodName , object ? [ ] args ,
210
211
IReadOnlyList < string > excludedConnectionIds ,
211
212
CancellationToken cancellationToken = new CancellationToken ( ) )
212
213
{
@@ -217,7 +218,7 @@ public override Task SendGroupExceptAsync(string groupName, string methodName, o
217
218
return group . SendExcept ( methodName , args , excludedConnectionIds ) ;
218
219
}
219
220
220
- public override Task SendUserAsync ( string userId , string methodName , object ? [ ] ? args ,
221
+ public override Task SendUserAsync ( string userId , string methodName , object ? [ ] args ,
221
222
CancellationToken cancellationToken = new CancellationToken ( ) )
222
223
{
223
224
if ( string . IsNullOrWhiteSpace ( userId ) ) throw new ArgumentNullException ( nameof ( userId ) ) ;
@@ -227,7 +228,7 @@ public override Task SendUserAsync(string userId, string methodName, object?[]?
227
228
return user . Send ( methodName , args ) ;
228
229
}
229
230
230
- public override Task SendUsersAsync ( IReadOnlyList < string > userIds , string methodName , object ? [ ] ? args ,
231
+ public override Task SendUsersAsync ( IReadOnlyList < string > userIds , string methodName , object ? [ ] args ,
231
232
CancellationToken cancellationToken = new CancellationToken ( ) )
232
233
{
233
234
var tasks = userIds . Select ( u => SendGroupAsync ( u , methodName , args , cancellationToken ) ) ;
@@ -305,4 +306,4 @@ public void Participate(ISiloLifecycle lifecycle)
305
306
}
306
307
307
308
public record AllMessage ( InvocationMessage Payload , IReadOnlyList < string > ? ExcludedIds = null ) ;
308
- }
309
+ }
0 commit comments