From 68259485f4e989e67880f207f7d96bc4b05df3d1 Mon Sep 17 00:00:00 2001 From: incastrix Date: Sat, 8 Dec 2007 16:57:43 +0000 Subject: [PATCH] Remove timeout in serverSocket, it not required and fix compatibility with Jsun VM 6. --- .../phpeclipse/xdebug/core/XDebugProxy.java | 53 ++++--------------- 1 files changed, 11 insertions(+), 42 deletions(-) diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugProxy.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugProxy.java index 3d6396a..d572ba2 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugProxy.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugProxy.java @@ -33,36 +33,30 @@ public class XDebugProxy { class ProxyListenerJob extends Job { public ProxyListenerJob() { super("XDebug Proxy Connection Dispatch"); - setSystem(true); - + setSystem(true); } /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) */ protected IStatus run(IProgressMonitor monitor) { - boolean timeout; boolean error; - Socket socket=null; - DataInputStream reader=null; - OutputStreamWriter writer=null; + Socket socket = null; + DataInputStream reader = null; + OutputStreamWriter writer = null; while (!fTerminate) { - timeout = false; error = false; - socket=null; - reader=null; - writer=null; + socket = null; + reader = null; + writer = null; if (monitor.isCanceled()) return Status.CANCEL_STATUS; try { socket = fProxyServerSocket.accept(); - } catch (java.net.SocketTimeoutException e) { - timeout=true; } catch (IOException e) { - error=true; -// e.printStackTrace(); + error = true; } - if (!(timeout || error)) { + if (!error) { XDebugCorePlugin.log(IStatus.INFO,"Proxy: someone tries to connect"); try { @@ -109,7 +103,6 @@ public class XDebugProxy { * @see org.eclipse.core.runtime.ISafeRunnable#run() */ public void run() throws Exception { - fListener.handleProxyEvent(fIdeKey, fInitString, fConnection); } @@ -161,42 +154,18 @@ public class XDebugProxy { return; try { fProxyServerSocket = new ServerSocket(fProxyPort); - // set 5sek as timeout - fProxyServerSocket.setSoTimeout(5000); XDebugCorePlugin.log(IStatus.INFO,"Proxy listens on port "+fProxyPort); - -// fDebugReader = new BufferedReader(new InputStreamReader(fDebugSocket.getInputStream())); - } catch (UnknownHostException e) { e.printStackTrace(); -// abort("Unable to connect to PHP Debuger", e); } catch (IOException e) { e.printStackTrace(); -// abort("Unable to connect to PHP Debuger", e); } - fTerminate=false; + fTerminate = false; fProxyListener = new ProxyListenerJob(); fProxyListener.schedule(); - fIsRunning=true; - + fIsRunning = true; } -/* public void stop() { - if (!fIsRunning) - return; - fTerminate=true; - fProxyListener.cancel(); - try { - fProxyServerSocket.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - fIsRunning = false; - XDebugCorePlugin.log(IStatus.INFO,"Proxy stopped"); - - }*/ - public void stop() { if (fIsRunning) { fProxyListener.cancel(); -- 1.7.1