1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-30 00:01:19 +00:00

Use correct announce server port for new installs.

This commit is contained in:
Felix Ableitner 2014-11-12 19:29:49 +02:00
parent 4f5a467ee0
commit f3ad255c7c

View file

@ -114,9 +114,10 @@ public class ConfigXml {
// Hardcode default globalAnnounceServer ip. // Hardcode default globalAnnounceServer ip.
Element globalAnnounceServer = (Element) Element globalAnnounceServer = (Element)
options.getElementsByTagName("globalAnnounceServer").item(0); options.getElementsByTagName("globalAnnounceServer").item(0);
if (globalAnnounceServer.getTextContent().equals("announce.syncthing.net:22025")) { if (globalAnnounceServer.getTextContent().startsWith("announce.syncthing.net:") ||
globalAnnounceServer.getTextContent().startsWith("194.126.249.5:")) {
Log.i(TAG, "Replacing globalAnnounceServer host with ip"); Log.i(TAG, "Replacing globalAnnounceServer host with ip");
globalAnnounceServer.setTextContent("194.126.249.5:22025"); globalAnnounceServer.setTextContent("194.126.249.5:22026");
changed = true; changed = true;
} }
@ -143,8 +144,7 @@ public class ConfigXml {
// HACK: Create .stfolders in all folders if it does not exist. // HACK: Create .stfolders in all folders if it does not exist.
// This is not the best place to put it, but it's only temporary. // This is not the best place to put it, but it's only temporary.
try { try {
boolean exists = new File(dir, ".stfolder").createNewFile(); new File(dir, ".stfolder").createNewFile();
Log.d(TAG, dir + Boolean.toString(exists));
} catch (IOException e) { } catch (IOException e) {
// This might happen if the device is not mounted. // This might happen if the device is not mounted.
Log.i(TAG, "Failed to create .stversions in " + dir, e); Log.i(TAG, "Failed to create .stversions in " + dir, e);
@ -155,13 +155,6 @@ public class ConfigXml {
} }
} }
// Change global announce server port to 22026 for syncthing v0.9.0.
if (globalAnnounceServer.getTextContent().equals("194.126.249.5:22025")) {
Log.i(TAG, "Changing announce server port for v0.9.0");
globalAnnounceServer.setTextContent("194.126.249.5:22026");
changed = true;
}
if (changed) { if (changed) {
saveChanges(); saveChanges();
} }