Skip to content

Commit b612da4

Browse files
justinvpdavidfowl
authored andcommitted
Avoid an unnecessary closure allocation in ListenerSecondary (#1485)
The tcs is being passed as the state, so use it from the state instead of closing over it.
1 parent a26f962 commit b612da4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/ListenerSecondary.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ private void ConnectedCallback(UvConnectRequest connect, int status, Exception e
109109
{
110110
req.Dispose();
111111

112+
var innerTcs = (TaskCompletionSource<int>)state;
112113
if (ex != null)
113114
{
114-
tcs.SetException(ex);
115+
innerTcs.SetException(ex);
115116
}
116117
else
117118
{
118-
tcs.SetResult(0);
119+
innerTcs.SetResult(0);
119120
}
120121
},
121122
tcs);

0 commit comments

Comments
 (0)