From: <mp...@us...> - 2013-01-28 06:55:50
|
Revision: 10485 http://sourceforge.net/p/freecol/code/10485 Author: mpope Date: 2013-01-28 06:55:46 +0000 (Mon, 28 Jan 2013) Log Message: ----------- Merge git.93ad952: ReceivingThread fixes. Modified Paths: -------------- freecol/trunk/src/net/sf/freecol/common/networking/ReceivingThread.java Modified: freecol/trunk/src/net/sf/freecol/common/networking/ReceivingThread.java =================================================================== --- freecol/trunk/src/net/sf/freecol/common/networking/ReceivingThread.java 2013-01-26 23:15:26 UTC (rev 10484) +++ freecol/trunk/src/net/sf/freecol/common/networking/ReceivingThread.java 2013-01-28 06:55:46 UTC (rev 10485) @@ -320,7 +320,7 @@ */ private void listen() throws IOException, SAXException, XMLStreamException { - final int LOOK_AHEAD = 500; + final int LOOK_AHEAD = 4096; BufferedInputStream bis = new BufferedInputStream(in, LOOK_AHEAD); in.enable(); bis.mark(LOOK_AHEAD); @@ -371,22 +371,28 @@ timesFailed = 0; } catch (XMLStreamException e) { timesFailed++; - if (shouldRun && timesFailed > MAXIMUM_RETRIES) { - disconnect("XML failure: " + e.getMessage()); + logger.log(Level.WARNING, "XML fail", e); + if (shouldRun() && timesFailed > MAXIMUM_RETRIES) { + disconnect("Too many failures (XML)"); } } catch (SAXException e) { timesFailed++; - if (shouldRun && timesFailed > MAXIMUM_RETRIES) { - disconnect("SAX failure: " + e.getMessage()); + logger.log(Level.WARNING, "SAX fail", e); + if (shouldRun() && timesFailed > MAXIMUM_RETRIES) { + disconnect("Too many failures (SAX)"); } } catch (IOException e) { - if (shouldRun) { - disconnect("IO failure: " + e.getMessage()); + logger.log(Level.WARNING, "IO fail", e); + if (shouldRun()) { + disconnect("Unexpected IO failure"); } } } + } catch (Exception e) { + logger.log(Level.WARNING, "Unexpected exception.", e); } finally { askToStop(); } + logger.info("Receiving thread " + getName() + " finished."); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |