Small fix
This commit is contained in:
@ -135,7 +135,7 @@ namespace CoopServer
|
||||
/// We try to remove the client when all files have been sent
|
||||
/// </summary>
|
||||
/// <param name="nethandle"></param>
|
||||
/// <param name="id">Not currently used but maybe we can need this sometime</param>
|
||||
/// <param name="id"></param>
|
||||
public static void TryToRemoveClient(long nethandle, int id)
|
||||
{
|
||||
lock (_clients)
|
||||
@ -146,12 +146,14 @@ namespace CoopServer
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.IsCurrentFile(id))
|
||||
{
|
||||
client.FilePosition++;
|
||||
}
|
||||
|
||||
if (client.DownloadComplete())
|
||||
{
|
||||
client.Finish();
|
||||
_clients.Remove(client);
|
||||
AddClientToRemove(client.NetHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,11 +161,14 @@ namespace CoopServer
|
||||
public static void AddClientToRemove(long nethandle)
|
||||
{
|
||||
lock (_clientsToDelete)
|
||||
{
|
||||
if (!_clientsToDelete.Contains(nethandle))
|
||||
{
|
||||
_clientsToDelete.Add(nethandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DownloadClient
|
||||
{
|
||||
@ -253,6 +258,11 @@ namespace CoopServer
|
||||
Server.MainNetServer.SendMessage(outgoingMessage, conn, NetDeliveryMethod.ReliableUnordered, (byte)ConnectionChannel.File);
|
||||
}
|
||||
|
||||
public bool IsCurrentFile(int id)
|
||||
{
|
||||
return _files[FilePosition].FileID == id;
|
||||
}
|
||||
|
||||
public bool DownloadComplete()
|
||||
{
|
||||
return FilePosition >= _files.Count;
|
||||
|
Reference in New Issue
Block a user