fix: Fixes networking (#822)

* Fixes wepoll to be POSIX compliant.
This commit is contained in:
Kamron Batman 2021-10-09 11:55:31 -07:00 • committed by GitHub
parent 05ff3f2ad9
commit 81486772f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 161 deletions

View file

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using Moq;
using Server.Network;
namespace Server.Tests.Network
@ -11,18 +9,8 @@ namespace Server.Tests.Network
public static Span<byte> Compile(this Packet p) =>
p.Compile(false, out var length).AsSpan(0, length);
public static NetState CreateTestNetState()
{
var socket = new Mock<ISocket>();
socket
.Setup(s => s.SendAsync(It.IsAny<IList<ArraySegment<byte>>>(), SocketFlags.None))
.ReturnsAsync(() => 0);
socket
.Setup(s => s.ReceiveAsync(It.IsAny<IList<ArraySegment<byte>>>(), SocketFlags.None))
.ReturnsAsync(() => 0);
return new NetState(socket.Object);
}
public static NetState CreateTestNetState() => new(
new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
);
}
}