From fa3397746966929ac7fd9798fcf42a340e1bb09d Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Thu, 16 Jun 2011 01:58:12 -0500 Subject: [PATCH] Log fullrender messages to commandsender, versus just log --- src/main/java/org/dynmap/DynmapPlugin.java | 4 ++-- src/main/java/org/dynmap/MapManager.java | 20 ++++++++++--------- .../org/dynmap/web/HttpServerConnection.java | 1 + 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index d703c812..17d27aaa 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -363,14 +363,14 @@ public class DynmapPlugin extends JavaPlugin { for (int i = 1; i < args.length; i++) { World w = getServer().getWorld(args[i]); if(w != null) - mapManager.renderFullWorld(new Location(w, 0, 0, 0)); + mapManager.renderFullWorld(new Location(w, 0, 0, 0),sender); else sender.sendMessage("World '" + args[i] + "' not defined/loaded"); } } else if (player != null) { Location loc = player.getLocation(); if(loc != null) - mapManager.renderFullWorld(loc); + mapManager.renderFullWorld(loc, sender); } else { sender.sendMessage("World name is required"); } diff --git a/src/main/java/org/dynmap/MapManager.java b/src/main/java/org/dynmap/MapManager.java index 1012eb37..eeaa6ca1 100644 --- a/src/main/java/org/dynmap/MapManager.java +++ b/src/main/java/org/dynmap/MapManager.java @@ -88,14 +88,16 @@ public class MapManager { MapTile tile0 = null; MapTile tile = null; int rendercnt = 0; + CommandSender sender; /* Full world, all maps render */ - FullWorldRenderState(DynmapWorld dworld, Location l) { + FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender) { world = dworld; loc = l; found = new HashSet(); rendered = new HashSet(); renderQueue = new LinkedList(); + this.sender = sender; } /* Single tile render - used for incremental renders */ @@ -122,7 +124,7 @@ public class MapManager { /* If render queue is empty, start next map */ if(renderQueue.isEmpty()) { if(map_index >= 0) { /* Finished a map? */ - Log.info("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' of world '" + + sender.sendMessage("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' of world '" + world.world.getName() + "' completed - " + rendercnt + " tiles rendered."); } found.clear(); @@ -130,7 +132,7 @@ public class MapManager { rendercnt = 0; map_index++; /* Next map */ if(map_index >= world.maps.size()) { /* Last one done? */ - Log.info("Full render of '" + world.world.getName() + "' finished."); + sender.sendMessage("Full render of '" + world.world.getName() + "' finished."); cleanup(); return; } @@ -184,7 +186,7 @@ public class MapManager { found.remove(tile); rendercnt++; if((rendercnt % 100) == 0) { - Log.info("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' on world '" + + sender.sendMessage("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' on world '" + w.getName() + "' in progress - " + rendercnt + " tiles rendered, " + renderQueue.size() + " tiles pending."); } } @@ -248,10 +250,10 @@ public class MapManager { } - void renderFullWorld(Location l) { + void renderFullWorld(Location l, CommandSender sender) { DynmapWorld world = getWorld(l.getWorld().getName()); if (world == null) { - Log.severe("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration."); + sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration."); return; } String wname = l.getWorld().getName(); @@ -259,15 +261,15 @@ public class MapManager { synchronized(lock) { rndr = active_renders.get(wname); if(rndr != null) { - Log.info("Full world render of world '" + wname + "' already active."); + sender.sendMessage("Full world render of world '" + wname + "' already active."); return; } - rndr = new FullWorldRenderState(world,l); /* Make new activation record */ + rndr = new FullWorldRenderState(world,l,sender); /* Make new activation record */ active_renders.put(wname, rndr); /* Add to active table */ } /* Schedule first tile to be worked */ renderpool.execute(rndr); - Log.info("Full render starting on world '" + wname + "'..."); + sender.sendMessage("Full render starting on world '" + wname + "'..."); } public void activateWorld(World w) { diff --git a/src/main/java/org/dynmap/web/HttpServerConnection.java b/src/main/java/org/dynmap/web/HttpServerConnection.java index 0a87cb18..e592188c 100644 --- a/src/main/java/org/dynmap/web/HttpServerConnection.java +++ b/src/main/java/org/dynmap/web/HttpServerConnection.java @@ -121,6 +121,7 @@ public class HttpServerConnection extends Thread { if (socket == null) return; socket.setSoTimeout(5000); + socket.setTcpNoDelay(true); InetSocketAddress rmtaddr = (InetSocketAddress)socket.getRemoteSocketAddress(); /* Get remote address */ InputStream in = socket.getInputStream(); BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream(), 40960);