import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugException;
+//import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.IDebugEventFilter;
import org.eclipse.debug.core.IDebugEventSetListener;
protected String fInitString;
protected String fIdeKey;
- protected AbstractDebugConnection fConnection;
+ /*protected*/ private /*AbstractDebugConnection*/ XDebugConnection fConnection;
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 {
// TODO Auto-generated catch block
e.printStackTrace();
}
- fConnection=(AbstractDebugConnection) new XDebugConnection(socket,reader,writer);
+ fConnection=/*(AbstractDebugConnection)*/ new XDebugConnection(socket,reader,writer);
if (fConnection.isInitialized()) {
fIdeKey=fConnection.getSessionID();
XDebugCorePlugin.log(IStatus.INFO,"<init idekey \""+fIdeKey+"\">");
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
public void run() throws Exception {
-
fListener.handleProxyEvent(fIdeKey, fInitString, fConnection);
}
*/
public void dispatch() {
fListener = (IProxyEventListener) getEventListener(fIdeKey);
- if (fListener==null) { // no listener is found so start the script
- try {
+ if (fListener == null) { // no listener is found so start the script
+ //try {
fConnection.run();
- } catch (DebugException e) {
+ /*} catch (DebugException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }*/
} else
Platform.run(this);
fListener = null;
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();