This commit is contained in:
Abdussamed ULUTAŞ 2023-03-05 15:33:10 +03:00
parent 79d277443c
commit 81f8e6b3e9
7 changed files with 14 additions and 7 deletions

View File

@ -24,6 +24,9 @@ exports.http = server;
app.get("/script",(request, response)=>{ app.get("/script",(request, response)=>{
response.sendFile(resolve("./script/index.js")) response.sendFile(resolve("./script/index.js"))
}); });
app.get("/test",(request, response)=>{
response.sendFile(resolve("./script/test.html"))
});
app.get("/index.js.map",(request, response)=>{ app.get("/index.js.map",(request, response)=>{
response.sendFile(resolve("./script/index.js.map")) response.sendFile(resolve("./script/index.js.map"))
}); });

View File

@ -20,7 +20,7 @@ process.on('message',data => {
break; break;
} }
case "CLIENT_SEND_MESSAGE":{ case "CLIENT_SEND_MESSAGE":{
slog("CLIENT_SEND_MESSAGE"); //slog("CLIENT_SEND_MESSAGE");
let client = Client.clients.get(data.uuid); let client = Client.clients.get(data.uuid);
if(client.isProxy != true) if(client.isProxy != true)
{ {
@ -164,10 +164,12 @@ function ROOM_DESTROY(room)
function mlog(command) function mlog(command)
{ {
return;
console.log("M",process.pid, command) console.log("M",process.pid, command)
} }
function slog(command) function slog(command)
{ {
return;
console.log("S",process.pid, command) console.log("S",process.pid, command)
} }

View File

@ -87,7 +87,6 @@ addService(({
let {to,pack, handshake,wom} = message; let {to,pack, handshake,wom} = message;
if(Room.rooms.has(to)) if(Room.rooms.has(to))
{ {
console.log("Oda da ", Room.rooms.get(to).clients.size,"kişi var")
if(!client.rooms.has(to)) if(!client.rooms.has(to))
{ {
return handshake && end({ return handshake && end({

View File

@ -1,3 +1,5 @@
const { mlog } = require("./IPC");
exports.ws_writed_bytes = 0; exports.ws_writed_bytes = 0;
exports.ws_readed_bytes = 0; exports.ws_readed_bytes = 0;
exports.ws_total_bytes = 0; exports.ws_total_bytes = 0;
@ -25,6 +27,7 @@ setInterval(()=>{
ws_recaived_packs: exports.ws_recaived_packs, ws_recaived_packs: exports.ws_recaived_packs,
ws_total_packs: exports.ws_total_packs ws_total_packs: exports.ws_total_packs
}) })
mlog(`writed ${exports.ws_writed_bytes} bytes, readed ${exports.ws_readed_bytes} bytes`);
exports.ws_writed_bytes = 0; exports.ws_writed_bytes = 0;
exports.ws_readed_bytes = 0; exports.ws_readed_bytes = 0;
exports.ws_total_bytes = 0; exports.ws_total_bytes = 0;

View File

@ -12,7 +12,7 @@ async function main()
{ {
if(cluster.isPrimary == false) if(cluster.isPrimary == false)
{ {
console.log("Slave", process.pid); console.log("Slave Process PID:", process.pid);
// This process is a worker / slave // This process is a worker / slave
// Compile source code and run // Compile source code and run
require("./Source/index"); require("./Source/index");
@ -21,12 +21,12 @@ async function main()
}; };
// This process is a primary / master // This process is a primary / master
console.log("Master", process.pid); console.log("Master Process PID:", process.pid);
// Worker process list // Worker process list
const master = new Map(); const master = new Map();
const coreCount = os.cpus().length; const coreCount = 3 //os.cpus().length;
for(let index = 0; index < coreCount; index++) for(let index = 0; index < coreCount; index++)
{ {
// Open slave process // Open slave process

View File

@ -669,7 +669,7 @@
meters.set(core, meter) meters.set(core, meter)
}; };
let _meter = meters.get(core); let _meter = meters.get(core);
_meter.update(ws_total_packs,0) _meter.update(ws_total_packs,ws_total_packs < 30 ? 0 : ws_total_packs < 60 ? 1 : ws_total_packs < 90 ? 2 : 3)
} }
} }
reloadData(); reloadData();

View File

@ -9,7 +9,7 @@
<body> <body>
<h2><pre id="log"></pre></h2> <h2><pre id="log"></pre></h2>
<h1 id="message"></h1> <h1 id="message"></h1>
<script src="./script/index.js"></script> <script src="http://localhost:7707/script"></script>
<script> <script>
async function main(){ async function main(){
const wsjs = new MWSE({ const wsjs = new MWSE({