Merge branch '1.3-update' of https://github.com/NyxStudios/TShock into 1.3-update
This commit is contained in:
commit
c79d2213e8
4 changed files with 47 additions and 44 deletions
26
TShock.sln
26
TShock.sln
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30501.0
|
||||
# Visual Studio Express 2013 for Windows Desktop
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{755F5B05-0924-47E9-9563-26EB20FE3F67}"
|
||||
EndProject
|
||||
|
|
@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TShockAPI", "TShockAPI\TSho
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TShockRestTestPlugin", "TShockRestTestPlugin\TShockRestTestPlugin.csproj", "{F2FEDAFB-58DE-4611-9168-A86112C346C7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerrariaServer", "TerrariaServerAPI\TerrariaServer.csproj", "{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerrariaServer", "TerrariaServerAPI\TerrariaServer.csproj", "{6877506E-ADC6-4142-98A6-79E4FA02855A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -41,16 +41,16 @@ Global
|
|||
{F2FEDAFB-58DE-4611-9168-A86112C346C7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{F2FEDAFB-58DE-4611-9168-A86112C346C7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{F2FEDAFB-58DE-4611-9168-A86112C346C7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Debug|x86.Build.0 = Debug|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Release|x86.ActiveCfg = Release|x86
|
||||
{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}.Release|x86.Build.0 = Release|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x86.Build.0 = Debug|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x86.ActiveCfg = Release|x86
|
||||
{6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace TShockAPI
|
|||
|
||||
private readonly TShock plugin;
|
||||
|
||||
private PacketBuffer[] buffers = new PacketBuffer[Netplay.serverSock.Length];
|
||||
private PacketBuffer[] buffers = new PacketBuffer[Netplay.Clients.Length];
|
||||
|
||||
private int[] Bytes = new int[52];
|
||||
private int[] Packets = new int[52];
|
||||
|
|
@ -117,29 +117,32 @@ namespace TShockAPI
|
|||
|
||||
public void FlushAll()
|
||||
{
|
||||
for (int i = 0; i < Netplay.serverSock.Length; i++)
|
||||
for (int i = 0; i < Netplay.Clients.Length; i++)
|
||||
{
|
||||
Flush(Netplay.serverSock[i]);
|
||||
Flush(Netplay.Clients[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Flush(ServerSock socket)
|
||||
public bool Flush(RemoteClient client)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (socket == null || !socket.active)
|
||||
if (client == null || !client.IsActive)
|
||||
return false;
|
||||
|
||||
if (buffers[socket.whoAmI].Count < 1)
|
||||
if (!client.Socket.IsConnected())
|
||||
return false;
|
||||
|
||||
if (buffers[client.Id].Count < 1)
|
||||
return false;
|
||||
|
||||
byte[] buff = buffers[socket.whoAmI].GetBytes(BytesPerUpdate);
|
||||
byte[] buff = buffers[client.Id].GetBytes(BytesPerUpdate);
|
||||
if (buff == null)
|
||||
return false;
|
||||
|
||||
if (SendBytes(socket, buff))
|
||||
if (SendBytes(client, buff))
|
||||
{
|
||||
buffers[socket.whoAmI].Pop(buff.Length);
|
||||
buffers[client.Id].Pop(buff.Length);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -153,22 +156,22 @@ namespace TShockAPI
|
|||
|
||||
private void ServerHooks_SocketReset(SocketResetEventArgs args)
|
||||
{
|
||||
buffers[args.Socket.whoAmI] = new PacketBuffer();
|
||||
buffers[args.Socket.Id] = new PacketBuffer();
|
||||
}
|
||||
|
||||
public bool SendBytes(ServerSock socket, byte[] buffer)
|
||||
public bool SendBytes(RemoteClient client, byte[] buffer)
|
||||
{
|
||||
return SendBytes(socket, buffer, 0, buffer.Length);
|
||||
return SendBytes(client, buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public void BufferBytes(ServerSock socket, byte[] buffer)
|
||||
public void BufferBytes(RemoteClient client, byte[] buffer)
|
||||
{
|
||||
BufferBytes(socket, buffer, 0, buffer.Length);
|
||||
BufferBytes(client, buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public void BufferBytes(ServerSock socket, byte[] buffer, int offset, int count)
|
||||
public void BufferBytes(RemoteClient client, byte[] buffer, int offset, int count)
|
||||
{
|
||||
lock (buffers[socket.whoAmI])
|
||||
lock (buffers[client.Id])
|
||||
{
|
||||
#if DEBUG_NET
|
||||
int size = (count - offset);
|
||||
|
|
@ -180,27 +183,27 @@ namespace TShockAPI
|
|||
#endif
|
||||
using (var ms = new MemoryStream(buffer, offset, count))
|
||||
{
|
||||
buffers[socket.whoAmI].AddRange(ms.ToArray());
|
||||
buffers[client.Id].AddRange(ms.ToArray());
|
||||
}
|
||||
|
||||
if (TShock.Config.EnableMaxBytesInBuffer && buffers[socket.whoAmI].Count > TShock.Config.MaxBytesInBuffer)
|
||||
if (TShock.Config.EnableMaxBytesInBuffer && buffers[client.Id].Count > TShock.Config.MaxBytesInBuffer)
|
||||
{
|
||||
buffers[socket.whoAmI].Clear();
|
||||
socket.kill = true;
|
||||
buffers[client.Id].Clear();
|
||||
client.PendingTermination = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool SendBytes(ServerSock socket, byte[] buffer, int offset, int count)
|
||||
public bool SendBytes(RemoteClient client, byte[] buffer, int offset, int count)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (socket.tcpClient.Client != null && socket.tcpClient.Client.Poll(0, SelectMode.SelectWrite))
|
||||
if (client.Socket != null && client.Socket.IsConnected())
|
||||
{
|
||||
if (ServerApi.RunningMono && !ServerApi.UseAsyncSocketsInMono)
|
||||
socket.networkStream.Write(buffer, offset, count);
|
||||
else
|
||||
socket.networkStream.BeginWrite(buffer, offset, count, socket.ServerWriteCallBack, socket.networkStream);
|
||||
//if (ServerApi.RunningMono && !ServerApi.UseAsyncSocketsInMono)
|
||||
client.Socket.AsyncSend(buffer, offset, count, null);
|
||||
//else
|
||||
//client.networkStream.BeginWrite(buffer, offset, count, socket.ServerWriteCallBack, socket.networkStream);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,9 +177,9 @@
|
|||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TerrariaServerAPI\TerrariaAPI-Server.csproj">
|
||||
<Project>{549A7941-D9C9-4544-BAC8-D9EEEAB4D777}</Project>
|
||||
<Name>TerrariaAPI-Server</Name>
|
||||
<ProjectReference Include="..\TerrariaServerAPI\TerrariaServer.csproj">
|
||||
<Project>{6877506e-adc6-4142-98a6-79e4fa02855a}</Project>
|
||||
<Name>TerrariaServer</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
|
||||
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 43f89df99eb0fb851829067f663d861be2fdeb78
|
||||
Subproject commit 1af4aab21ad6775d50b1c992c9fec5fcf42f0c08
|
||||
Loading…
Add table
Add a link
Reference in a new issue