Merge pull request #486 from quasar/pr/485

Update Mono.Nat
This commit is contained in:
MaxXor 2016-07-18 20:28:31 +02:00 committed by GitHub
commit 5103262007
4 changed files with 7 additions and 4 deletions

View File

@ -310,7 +310,8 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(TargetDir)client.bin" /Y</PostBuildEvent>
<PostBuildEvent Condition="'$(OS)' == 'Windows_NT' ">copy "$(TargetPath)" "$(TargetDir)client.bin" /Y</PostBuildEvent>
<PostBuildEvent Condition="'$(OS)' != 'Windows_NT' ">cp "$(TargetPath)" "$(TargetDir)client.bin"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -256,7 +256,9 @@ public void Listen(ushort port, bool ipv6)
if (Socket.OSSupportsIPv6 && ipv6)
{
_handle = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
_handle.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, false);
// fix for mono compatibility, SocketOptionName.IPv6Only
SocketOptionName ipv6only = (SocketOptionName)27;
_handle.SetSocketOption(SocketOptionLevel.IPv6, ipv6only, 0);
_handle.Bind(new IPEndPoint(IPAddress.IPv6Any, port));
}
else

View File

@ -70,7 +70,7 @@ public static bool CreatePortMap(int port, out int externalPort)
Mapping mapping = new Mapping(Protocol.Tcp, port, port);
for (int i = 0; i < 3; i++)
_device.CreatePortMap(mapping);
_device.CreatePortMapAsync(mapping);
if (_mappings.ContainsKey(mapping.PrivatePort))
_mappings[mapping.PrivatePort] = mapping;
@ -102,7 +102,7 @@ public static void DeletePortMap(int port)
try
{
for (int i = 0; i < 3; i++)
_device.DeletePortMap(mapping);
_device.DeletePortMapAsync(mapping);
}
catch (MappingException)
{

Binary file not shown.