📄 startserver.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: StartServer.java
package org.gudy.azureus2.ui.common;
import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.log4j.Logger;
// Referenced classes of package org.gudy.azureus2.ui.common:
// Main
public class StartServer extends Thread
{
private ServerSocket socket;
private int state;
private Main main;
private boolean bContinue;
public static final int STATE_FAULTY = 0;
public static final int STATE_LISTENING = 1;
public StartServer()
{
super("Start Server");
try
{
socket = new ServerSocket(6880, 50, InetAddress.getByName("127.0.0.1"));
state = 1;
Logger.getLogger("azureus2").info("StartServer: listening on 127.0.0.1:6880 for passed torrent info");
}
catch (Exception e)
{
state = 0;
System.out.println("StartServer ERROR: unable to bind to 127.0.0.1:6880 for passed torrent info");
}
}
public void run()
{
bContinue = true;
_L2:
BufferedReader br;
if (!bContinue)
break; /* Loop/switch isn't completed */
br = null;
Socket sck = socket.accept();
String address = sck.getInetAddress().getHostAddress();
if (address.equals("localhost") || address.equals("127.0.0.1"))
{
br = new BufferedReader(new InputStreamReader(sck.getInputStream()));
String line = br.readLine();
if (line != null)
{
StringTokenizer st = new StringTokenizer(line, ";");
List argsList = new ArrayList();
for (; st.hasMoreElements(); argsList.add(st.nextToken().replaceAll("&;", ";").replaceAll("&&", "&")));
if (argsList.size() > 1)
{
String checker = (String)argsList.remove(0);
if (checker.equals("Azureus Start Server Access"))
{
if (argsList.get(0).equals("args"))
{
argsList.remove(0);
String newargs[] = new String[argsList.size()];
argsList.toArray(newargs);
Main.processArgs(newargs, null, null);
} else
{
Logger.getLogger("azureus2").error((new StringBuilder()).append("Something strange was sent to the StartServer: ").append(line).toString());
}
} else
{
Logger.getLogger("azureus2").error("StartServer: Wrong access token.");
}
}
}
}
sck.close();
Exception e;
try
{
if (br != null)
br.close();
}
// Misplaced declaration of an exception variable
catch (Exception e) { }
continue; /* Loop/switch isn't completed */
e;
if (!(e instanceof SocketException))
e.printStackTrace();
bContinue = false;
try
{
if (br != null)
br.close();
}
// Misplaced declaration of an exception variable
catch (Exception e) { }
if (true) goto _L2; else goto _L1
Exception exception;
exception;
try
{
if (br != null)
br.close();
}
catch (Exception e) { }
throw exception;
_L1:
}
public void stopIt()
{
bContinue = false;
try
{
socket.close();
}
catch (Exception e) { }
}
public int getServerState()
{
return state;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -