mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Add a connect and read timeout for downloading libraries. This should really stop the "waiting forever" at startup screen.
This commit is contained in:
1 parent
0d5affede3
commit
9c6c56c49d
1 file changed
+4
-2
@@ -412,6 +412,8 @@ public class RelaunchLibraryManager
|
|||||||
downloadMonitor.updateProgressString(infoString);
|
downloadMonitor.updateProgressString(infoString);
|
||||||
FMLRelaunchLog.info(infoString);
|
FMLRelaunchLog.info(infoString);
|
||||||
URLConnection connection = libDownload.openConnection();
|
URLConnection connection = libDownload.openConnection();
|
||||||
|
connection.setConnectTimeout(5000);
|
||||||
|
connection.setReadTimeout(5000);
|
||||||
connection.setRequestProperty("User-Agent", "FML Relaunch Downloader");
|
connection.setRequestProperty("User-Agent", "FML Relaunch Downloader");
|
||||||
int sizeGuess = connection.getContentLength();
|
int sizeGuess = connection.getContentLength();
|
||||||
performDownload(connection.getInputStream(), sizeGuess, hash, libFile);
|
performDownload(connection.getInputStream(), sizeGuess, hash, libFile);
|
||||||
@@ -422,13 +424,13 @@ public class RelaunchLibraryManager
|
|||||||
{
|
{
|
||||||
if (downloadMonitor.stopIt)
|
if (downloadMonitor.stopIt)
|
||||||
{
|
{
|
||||||
FMLRelaunchLog.warning("You have stopped downloads in progress");
|
FMLRelaunchLog.warning("You have stopped the downloading operation before it could complete");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e instanceof RuntimeException) throw (RuntimeException)e;
|
if (e instanceof RuntimeException) throw (RuntimeException)e;
|
||||||
FMLRelaunchLog.severe("There was a problem downloading the file %s automatically. Perhaps you " +
|
FMLRelaunchLog.severe("There was a problem downloading the file %s automatically. Perhaps you " +
|
||||||
"have an environment without internet access. You will need to download " +
|
"have an environment without internet access. You will need to download " +
|
||||||
"the file manually\n", libFile.getName());
|
"the file manually or restart and let it try again\n", libFile.getName());
|
||||||
libFile.delete();
|
libFile.delete();
|
||||||
throw new RuntimeException("A download error occured", e);
|
throw new RuntimeException("A download error occured", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user