From 6b797f75e46e4d3014e5467ba38eef0afc2ed3ae Mon Sep 17 00:00:00 2001 From: DevSnaith <65865554+DevSnaith@users.noreply.github.com> Date: Fri, 14 Apr 2023 01:37:34 +0300 Subject: [PATCH] Change the file name --- bin/org/eu/lumiere/net/WebServer.class | Bin 3494 -> 0 bytes src/org/eu/lumiere/net/WebServer.java | 90 ------------------------- 2 files changed, 90 deletions(-) delete mode 100644 bin/org/eu/lumiere/net/WebServer.class delete mode 100644 src/org/eu/lumiere/net/WebServer.java diff --git a/bin/org/eu/lumiere/net/WebServer.class b/bin/org/eu/lumiere/net/WebServer.class deleted file mode 100644 index c21063f6da9e05c4ff1bc0fb11b2e23bd0f04235..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3494 zcmb7G`*Rc575=Uydu6e9uzAF!2G)SFB?m+UP6(zH|=J;=X6-V39V{&h!^D(`kO{KhVFU)2aKNUA-*RHl307-o5vnbIY0&on!)euqWDY%PitCY4&%X!PS(vIb)=dAe|%U!Wt4KanSSIreOZJW+w zdTRcvmGd>UDs<*nT%Up&3VMO}3J-^7C8jW-nL_TG zvCsTEXVgK*LpJVCh05q0_kcwAv`6Ijg|Q)uyg)AhyWCv~)=qYcA& zkA{;Bp-J~aa2+7LS!>0zb)3R`6|}jL>B-FGn8M-aQ2wj>u!a%RubI?mN_l(1auYa; zQ62BYS)Qn?-`~oC3e$r z!!i=ptd0pxlGtXkXgLcChaO~O)3FuLhsDHs9ZzFgA?_E#GZnUzjm^PQwg(q?bld8dYo>JM1@Hvxf5P%SbJ5apZ9|QO zZ7_kWSe7^(g=Ax1t1WuC0jU~aM60Od3F%D{>xMLm2lyb>>iLDDNSAc1h;$osYPoKy z=nH~3bljBHmYiMi*zs;jL?5e0lrN++Q?-a{hiqKtAyJZ5K>w7E=LPgwX7b!r9G_9p zjgrU9AjC4k485r1v-liqh`5{&x<6ZMMkx9PVfhz%yD^y!!Gs~#xvcPI9UdML@4uqs zt9V%oBPR)@+f_~nYzZ%pEf~Vrb$kQgq&o#?wBR_r5SeT#f$*RPX(`2Tv1d+N*NwWU zk-)2XO~Y;O)Y%x=*YO>ESD}OPWN2q(VZmj(6}lT;Y1m+ z&N`QuZ-9>4*TZ3Pi8y5lk~?afo@dcOyxL;X%M?cWZ{h6}ksFGiB@wxVf{|BHFtUdS zBQK(0WK9MmuOp5v)Zc-fd_K&#zfnKN@p$SUx>Il9U2Et~b?sk6Un;tW{#57Qm)DR? z4Zej$>Mr_L5gU}f-Lm-T8V2uBH;O}i9;6?jLwR z>|G&hj|DmFAy&Kjfw_mf`?$X!<2Zm>^kISH5(aRC;eVXCy@0_0!JT1H6$Hm&;5oRo zE@&M?YsbN-HC$Qe7f6W76&ZUp46pOt>QXdZBBK8wlX|7BL(uT|3TVspyZ?3w+FS1& zv>;eNB#;sa?&8_|*e637*H_V91F?*c)_@amCUAj`oizL%F0v7_)hFHfzQ^T$8T=+yaTIE!teVY!F z6rXG&#ivP%R2eUn@%ct>tYS$5lENtCORKmXhWC=hHh3THG7SD6UyFdVs@bkrNHfyq z+hu&OiEIA}7HTsEVvY>@@$L1O8q9H8rS9uZ=I)RnN90lj3MPt1nuDri)xe- zg5wzF#wqm_-?Bt?f;pI^&J^#H^LT}FuVV&(CDwwlK|8?P6@*3q=lBHyeV$l9SHpT2 zT935<6WtnKT_=B~T;*|V`&LeP2k|NWCoRhyTNq06*PKLxX3`og&IRY`p+M!l2!0tz R{R$#2O=FlJO}{z4>)$-FP7MG6 diff --git a/src/org/eu/lumiere/net/WebServer.java b/src/org/eu/lumiere/net/WebServer.java deleted file mode 100644 index f33d447..0000000 --- a/src/org/eu/lumiere/net/WebServer.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.eu.lumiere.net; - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; - -import org.eu.lumiere.loggers.GlobalLogger; -import org.eu.lumiere.loggers.GlobalLogger.LogLevel; - -public class WebServer implements Runnable { - - private GlobalLogger l = GlobalLogger.getLogger(); - private String threadName = "Lumiere server thread"; - private boolean isRunning = false; - private Thread thread; - - private int port = 8080; - private ServerSocket server; - private ServerEvents e; - - public WebServer(String name, ServerEvents e, int port) { - this.threadName = name == null ? this.threadName : name; - this.port = port; - this.e = e; - } - - public synchronized void start() { - if(isRunning || thread != null) { - l.printf(LogLevel.WARNING, threadName + " is already running", null); - return; - } - - try { - server = new ServerSocket(port); - } catch (Exception ex) { - l.printf(LogLevel.ERROR, ex instanceof IllegalArgumentException ? - "Server port must be between 0 and 65535" : ex.getMessage(), null); - } - - thread = new Thread(this, threadName); - isRunning = true; - thread.start(); - } - - public synchronized void stop() { - if(!isRunning || thread == null) { - l.printf(LogLevel.WARNING, threadName + " is already running", null); - return; - } - - thread.interrupt(); - isRunning = false; - thread = null; - - if(server != null) { - try { - server.close(); - } catch (IOException e) { - l.printf(LogLevel.ERROR, e.getMessage(), null); - } - } - } - - @Override - public void run() { - l.printf(LogLevel.INFO, threadName + " using port " + getPort(), null); - while(isRunning && !thread.isInterrupted()) { - try { - - if(server == null) { - stop(); - continue; - } - - Socket s = server.accept(); - if(e != null) - e.onConnection(s); - l.printf(LogLevel.INFO, "New Connection " + s.getInetAddress().getHostAddress(), null); - } catch (IOException ex) { - l.printf(LogLevel.ERROR, ex.getMessage(), null); - } - } - l.printf(LogLevel.INFO, threadName + " has been stopped", null); - } - - public int getPort() { - return this.port; - } - -}