X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=map-server%2Faltos-map%2FAltosMap.java;h=d78396d0d9d59113d388db27d8d047916681b793;hb=21c630af7181a03b44cfcfa1cc787212501785ec;hp=83bc7cea6d27578435e2fe663af5b63b92a77cff;hpb=3b817a2b854065af23c9ec8e849150e6930f51e9;p=fw%2Faltos
diff --git a/map-server/altos-map/AltosMap.java b/map-server/altos-map/AltosMap.java
index 83bc7cea..d78396d0 100644
--- a/map-server/altos-map/AltosMap.java
+++ b/map-server/altos-map/AltosMap.java
@@ -56,7 +56,11 @@ public class AltosMap {
public void fail(int status, String reason) {
write_status(status);
write_type("text/html");
+ System.out.printf("\n");
+ System.out.printf("\n");
+ System.out.printf("
Map Fetch Failure\n");
System.out.printf("%s\n", reason);
+ System.out.printf("\n");
System.exit(1);
}
@@ -105,7 +109,17 @@ public class AltosMap {
fail(400, "Missing zoom");
try {
- Socket socket = new Socket(InetAddress.getLoopbackAddress(), port);
+ Socket socket = null;
+ int tries = 0;
+
+ while (tries < 10 && socket == null) {
+ try {
+ socket = new Socket(InetAddress.getLoopbackAddress(), port);
+ } catch (IOException ie) {
+ Thread.sleep(100);
+ tries++;
+ }
+ }
AltosJson request = new AltosJson();
@@ -133,6 +147,7 @@ public class AltosMap {
String content_type = reply.get_string("content_type", null);
System.out.printf("Content-Type: %s\n", content_type);
System.out.printf("Content-Length: %d\n", file.length());
+ System.out.printf("\n");
byte[] buf = new byte[4096];
int bytes_read;
while ((bytes_read = in.read(buf)) > 0)