3 using System.Collections.Immutable;
15 FailedToCreateEosP2PSocket,
18 FailedToCreateSteamP2PSocket
21 public readonly record
struct Error(
22 ImmutableArray<(
ErrorCode Code, string AdditionalInfo)> CodesAndInfo)
24 public Error(
ErrorCode code,
string? additionalInfo =
"") :
this((code, additionalInfo ??
"").ToEnumerable().ToImmutableArray()) { }
25 public Error(params
Error[] innerErrors) :
this(innerErrors.SelectMany(ie => ie.CodesAndInfo).ToImmutableArray()) { }
27 public override string? ToString()
29 if (CodesAndInfo.IsDefault)
31 return "default(Error)";
34 return $
"Errors({string.Join(";
", CodesAndInfo)})";
40 Action<
P2PEndpoint, PeerDisconnectPacket> OnConnectionClosed,
readonly record struct Error(ImmutableArray<(ErrorCode Code, string AdditionalInfo)> CodesAndInfo)
readonly record struct Callbacks(Predicate< P2PEndpoint > OnIncomingConnection, Action< P2PEndpoint, PeerDisconnectPacket > OnConnectionClosed, Action< P2PEndpoint, IReadMessage > OnData)
abstract bool SendMessage(P2PEndpoint endpoint, IWriteMessage outMsg, DeliveryMethod deliveryMethod)
abstract void ProcessIncomingMessages()
readonly Callbacks callbacks
P2PSocket(Callbacks callbacks)
abstract void CloseConnection(P2PEndpoint endpoint)