Files
YunTongJackYunTask/Reportapi/FrameWork/Fleck/SubProtocolNegotiator.cs
2025-07-04 09:50:02 +08:00

23 lines
594 B
C#

using System;
using System.Linq;
using System.Collections.Generic;
namespace Fleck
{
public static class SubProtocolNegotiator
{
public static string Negotiate(IEnumerable<string> server, IEnumerable<string> client)
{
if (!server.Any() || !client.Any()) {
return null;
}
var matches = client.Intersect(server);
if (!matches.Any()) {
throw new SubProtocolNegotiationFailureException("Unable to negotiate a subprotocol");
}
return matches.First();
}
}
}