Some more logic to handle missing sub files and active file transfers when starting a round:
- server waits for transfers to finish before starting the round (up to a max 20 seconds, can be skipped by the host) - clients enable the spectate button when the round starts (in case they fail to start the round due to a missing sub file or an error) - clients notify the server if a transfer is cancelled + FileReceivers can't be instantiated if a server is running
This commit is contained in:
@@ -154,6 +154,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
public FileReceiver(string downloadFolder)
|
||||
{
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
throw new InvalidOperationException("Creating a file receiver is not allowed when a server is running.");
|
||||
}
|
||||
|
||||
activeTransfers = new List<FileTransferIn>();
|
||||
|
||||
this.downloadFolder = downloadFolder;
|
||||
@@ -161,6 +166,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void ReadMessage(NetIncomingMessage inc)
|
||||
{
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
throw new InvalidOperationException("Receiving files when a server is running is not allowed");
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.Assert(!activeTransfers.Any(t =>
|
||||
t.Status == FileTransferStatus.Error ||
|
||||
t.Status == FileTransferStatus.Canceled ||
|
||||
|
||||
Reference in New Issue
Block a user