mirror of
https://github.com/devsnaith/lumiere-server.git
synced 2024-11-23 17:13:14 +03:00
Change the file name
This commit is contained in:
parent
3ffa7805ca
commit
565bb791ca
@ -32,14 +32,14 @@ public class RequestListener implements Runnable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
server = new ServerSocket(port);
|
server = new ServerSocket(port);
|
||||||
|
thread = new Thread(this, threadName);
|
||||||
|
isRunning = true;
|
||||||
|
thread.start();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
l.printf(LogLevel.ERROR, ex instanceof IllegalArgumentException ?
|
l.printf(LogLevel.ERROR, ex instanceof IllegalArgumentException ?
|
||||||
"Server port must be between 0 and 65535" : ex.getMessage(), null);
|
"Server port must be between 0 and 65535" : ex.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread = new Thread(this, threadName);
|
|
||||||
isRunning = true;
|
|
||||||
thread.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void stop() {
|
public synchronized void stop() {
|
||||||
@ -65,24 +65,25 @@ public class RequestListener implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
l.printf(LogLevel.INFO, threadName + " using port " + getPort(), null);
|
l.printf(LogLevel.INFO, threadName + " using port " + getPort(), null);
|
||||||
while(isRunning && !thread.isInterrupted()) {
|
while(isRunning && !thread.isInterrupted()) {
|
||||||
try {
|
if(server != null) {
|
||||||
|
try {
|
||||||
if(server == null) {
|
Socket s = server.accept();
|
||||||
stop();
|
if(e != null)
|
||||||
continue;
|
e.onConnection(s);
|
||||||
}
|
} catch (IOException ex) {
|
||||||
|
l.printf(LogLevel.ERROR, ex.getMessage(), null);
|
||||||
Socket s = server.accept();
|
}
|
||||||
if(e != null)
|
continue;
|
||||||
e.onConnection(s);
|
|
||||||
// l.printf(LogLevel.INFO, "New Connection " + s.getInetAddress().getHostAddress(), null);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
l.printf(LogLevel.ERROR, ex.getMessage(), null);
|
|
||||||
}
|
}
|
||||||
|
stop();
|
||||||
}
|
}
|
||||||
l.printf(LogLevel.INFO, threadName + " has been stopped", null);
|
l.printf(LogLevel.INFO, threadName + " has been stopped", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRunning() {
|
||||||
|
return isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPort() {
|
public int getPort() {
|
||||||
return this.port;
|
return this.port;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user