From 3cd23b0956ad7346dd639938a21a917a4352aa07 Mon Sep 17 00:00:00 2001 From: Serafim Date: Thu, 12 Dec 2024 16:43:48 +0300 Subject: [PATCH] vmem, relaunch --- client/client | Bin 30896 -> 30896 bytes client/client.cpp | 31 ++++++++++++++++--- server1/server | Bin 54864 -> 55160 bytes server1/server.cpp | 75 ++++++++++++++++++++++++++++++++++++++++----- server2/server | Bin 54864 -> 60560 bytes server2/server.cpp | 75 ++++++++++++++++++++++++++++++++++++++++----- 6 files changed, 162 insertions(+), 19 deletions(-) diff --git a/client/client b/client/client index 1fb5a66499770ddf1478fdfc0856bdb0f8a88600..84d945e8eff6178bb430b0ab59f53f502e7ae0b4 100755 GIT binary patch delta 4845 zcmZu#33L=y7Ok$NLui)H)}-k`2r3BzStOl>B%_$5LmS|XgaBd7%pAg&qXeZBVMKeB zfHXxr9KOte!=l0{<8kK1G%D%5^oumn@q!24pg?tOu~OxdP*XQ|dTEc1z7Nyob~lZ*fR ze%}9l3-dgdn9pN&{jMyqIckAfY%dIS#6BAecu;Q zOIF^x#<|_gyS%S1VXN zsISZ_3=zli;Olc8kj#DglyQ2?YjMaAR_|c)2te!GtWUIo*&oY#M=}` zvaR45lTXapR*%d}Pekye3BQQr`35S1 zk5^wD+u;5>9Dq|l9sZ6kSYF}`TpNk;60~LWMoj304<&_l_#4kCE2}gDNxaK-c$$y! zL&(j;e-!QILaas*iW*NDZaAepMp%~~cBB^e@I*t0sTc|RahF1eDg$rR@fR<19UhP1 zQwYD1<6Yi1+)1U}iBq%=(sc0g4e&giZa8aqC2%Di6q738hY3!4^Jj_S@^|w@xJR_S z$&tMKFcSPGiu3$X$9w(e6}m%(=J4%pMqwUuc$qu!1^X9w;yjmG`tuxs5I69=9M5^K z`r+q1od(Y)(_twWNPnox${XKp_eJ`zWm6oNBOqRL9T5tQRz|Wlw-5x*Mz2IfN!jl9lXG?ie;a zcM$tv;wf=k7u%CNQapW;9nQV`*6QyN#CH_XgQS@69eQtjmj>58)Fyarm}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- a/client/client.cpp +++ b/client/client.cpp @@ -30,9 +30,16 @@ void* recieve(void* arg) { while (true) { char buffer[128]; ssize_t recieved = recv(client_socket, buffer, sizeof(buffer), 0); - if (recieved == 0 || recieved == -1) { + if (recieved == 0) { + std::cout << "Server shutted down" << std::endl; + close(client_socket); break; } + + if (recieved == -1) { + break; + } + std::cout << buffer << std::endl; } @@ -53,6 +60,7 @@ void* timer(void* arg) { int main() { pthread_t t1 = -1, t2 = -1; + pthread_t tid1, tid2; std::cout << "Usage:\n\tconnectN - connect to the server\n\tdisconnectN - disconnect from the server\n\tsendN - send request to the server\n\ttimerN - begin polling of the server\n\tstopN - stop polling of the server\n\tquit - quit" << std::endl; @@ -71,10 +79,10 @@ int main() { server_address1.sin_addr.s_addr = inet_addr(SERVER_IP1.c_str()); if (connect(client_socket1, (struct sockaddr*)&server_address1, sizeof(server_address1)) == 0) { std::cout << "Connected to the server 1" << std::endl; - pthread_t tid1; int* client_socket_copy1 = new int(client_socket1); pthread_create(&tid1, nullptr, &recieve, client_socket_copy1); } else { + client_socket1 = -1; std::cout << "Failed to connect " << std::strerror(errno) << std::endl; } } else if (command == "connect2") { @@ -85,25 +93,38 @@ int main() { server_address2.sin_addr.s_addr = inet_addr(SERVER_IP2.c_str()); if (connect(client_socket2, (struct sockaddr*)&server_address2, sizeof(server_address2)) == 0) { std::cout << "Connected to the server 2" << std::endl; - pthread_t tid2; int* client_socket_copy2 = new int(client_socket2); pthread_create(&tid2, nullptr, &recieve, client_socket_copy2); } else { + client_socket2 = -1; std::cout << "Failed to connect " << std::strerror(errno) << std::endl; } } else if (command == "disconnect1") { if (client_socket1 != -1) { close(client_socket1); + pthread_cancel(tid1); client_socket1 = -1; std::cout << "Disconnected" << std::endl; + + if (t1 != -1) { + pthread_cancel(t1); + t1 = -1; + std::cout << "Timer removed" << std::endl; + } } else { std::cout << "Server is not connected" << std::endl; } } else if (command == "disconnect2") { if (client_socket2 != -1) { - close(client_socket1); + close(client_socket2); + pthread_cancel(tid2); client_socket2 = -1; std::cout << "Disconnected" << std::endl; + if (t2 != -1) { + pthread_cancel(t2); + t2 = -1; + std::cout << "Timer removed" << std::endl; + } } else { std::cout << "Server is not connected" << std::endl; } @@ -129,7 +150,7 @@ int main() { std::cout << "Server is not connected" << std::endl; } } else if (command == "timer2") { - if (client_socket1 != -1) { + if (client_socket2 != -1) { int* client_socket_copy2 = new int(client_socket2); pthread_create(&t2, nullptr, &timer, client_socket_copy2); pthread_detach(t2); diff --git a/server1/server b/server1/server index aa7bfcde292d1ebc0d01fd3bdb1801f6315da787..69d8afea6338487dc6acbd3c0a4405866af7d320 100755 GIT binary patch delta 16316 zcmaJ|30zdw{=fIapd!fbFbFsZ?ume)p}5BAprU9}>;g1KO6Pv2ljI*s$fj`+-_ zu+@525?1DtxFlMrh)XV&n5JWBsg==U^Z)+NxifR2_x{(9_jk_sx18Vko!>e4oXgzW zZC;JGbkHSOv=M*x;6Wc{j(? zxy%aAwXl=GD+p&@bm8bP+1kM6^i*c%wc&Cew{eiSd6n~SbB)rq-YnTCRNlyfV5Na` z#<0Xzdielb9v{kr#mG|NX_vt!stL6G| zxrFyBm)i;Ey5mWL)t>NXr(1@~e{tK-^8O5MUKl@XP7dXwxuCoez0vaMmY9MDQq zH2=KVeis#GzCKc*S}*MSVoM1+?bQ1G#(yKgiqsi(y6QI! z6a`4}E1{pD4t3RW;gK}2aoui)-)4!C-Q^rMDYBTtl!=11xM zvou^UmKmjI+oJsZr)p3gTL$zipz}0n3-&Hhzi2=IA`RM#eGN1XXsHHm&HSVFEFWmO z2K8tCfo=l2U4sU&0-!ZOt2Ag3+YIziptTw_gdGF=Kzl#`dJP)J?nmnlZ8Z_Nt>Nlf zkM?>)xP~jeEGiVA2sWv`p6!9fKn)tn>_Beq*k+)A0*>_bJ}}*rX1KH!KEf(EiL0^d?ZF1|7)u0*#DCyfx@xcB_Nle~8BZAT~G_ z&qBzVG-wu^4>Tv%&oE4bPSse-V9Ox!74+t5&=Kt2SiNDSMy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Ni zqsxDba}{v*H9u1-@$sI^HYFdf`ZZ0$+6B_r*zA8P?zbZ(%ugU(qA6pIP0tb6FZgOd zgN-rLgh`w(C4AS5g8Lh|9C=o$#C@~VPCH>Im43vv7hmlwF|j!Q<7(7=^Pn9KTx-)8 z@YQ|@UsChh($rS!TU$Z21>AdMq_2GCD_q5l|M;=i=6VZUw!cZuQ8oNp4~zxl-G<8u z`I(K&FoiE3E8Dvy(blT5Tcg%1Ke}+)tmONuj4hS0_8stWEfz=WQiUjTNiZ5~>Fe*r zudoB2;A7ii=j71pPUJ-jPk2;nURMU*Q+R<&Ay%#^UWKn!L!Gbi-gM|Sn?8!KuBUOX zU|-QHFApf0uNB@!-RO2J{3dW7*c27LZ`(G-ad#VQElQQ3BB8)pKBmv%GPP0gsW}5lz6nx=JB<{Kc6I3mMG1Em{n}?`~(TK zR`_~_*UgYe;h!n_rb<2;y8!G&YBwK|$O^@9()o2ZeLP>Y3#5?to(k?2C39Qh$!cb0 zE4*Kl46g2sTMk?##Io66yXC8OuqR8cx*-ly_}-D4C}@hZ1eGLCul@$je4YQB6RsIY zm9$mGI#5XmHIdfas8y4%@Fk?Lw`H6Hm-m*(dPtbx6>#}oY4x2b+a5`@2WZ)PTXqhz z$b<0sSP5f`5M`CZ7psVU__qolGhWL128};w5qaq_oolf8!XPOj-V2~Q7dU&mr6#Wm zQ(FyOLaF)_3ym(XS2kkDdcAD=XWdL?+soGlmCf8cPmdZaUbv1HFI-3GO?o0{ z?1Wim*T2~pQ14j(6NrezGsJUH!VNb(f_!XRV;0k(}`m)Q?-dke7nH3HHuDt a+c7BoP05QS`*)p!o9vgZ);gU$nDD<2j6j?K diff --git a/server1/server.cpp b/server1/server.cpp index 55d3eac..4a61762 100644 --- a/server1/server.cpp +++ b/server1/server.cpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include /* Configuration */ @@ -51,9 +53,6 @@ int active_connections = 0; // Total amount of handled requests int handndled_requests = 0; -// Amount of active timers for sending messages -int active_timer_threads = 0; - // Initializes ncurses lib void init_ncurses() { @@ -140,12 +139,43 @@ std::string get_mem_percent() { return "Physical memory: " + std::to_string(100 * (total_mem - free_mem)/total_mem) + "%\n"; } + +std::string get_vmem() { + std::ifstream meminfo("/proc/self/status"); + if(!meminfo) { + return "Error: failed to open /proc/meminfo\n"; + } + + std::string line; + long not_free_mem = -1, total_mem = -1; + + while((std::getline(meminfo, line))) { + if(line.find("VmRSS:") == 0) { + std::sscanf(line.c_str(), "VmRSS: %ld kB", ¬_free_mem); + } else if(line.find("VmSize:") == 0) { + std::sscanf(line.c_str(), "VmSize: %ld kB", &total_mem); + } + + if(not_free_mem != -1 && total_mem != -1) { + break; + } + } + + meminfo.close(); + + if(total_mem == -1 || not_free_mem == -1) { + return "Error: failed to read info from /proc/meminfo\n"; + } + + return "Virtual memory of the proccess: " + std::to_string(100.0 * not_free_mem/total_mem) + "%\n"; +} + // Returns message to send according to the server type std::string get_sysinfo() { if (SERVER_TYPE == "server1") { return '\t' + get_last_error() + "\t\t\t" + get_cursor_position(); } - return '\t' + get_mem_percent() + "\t\t\t" + "WIP\n"; // TODO: vmem + return '\t' + get_mem_percent() + "\t\t\t" + get_vmem(); // TODO: vmem } // Writes log message on screen and passes it to the logging pipe @@ -247,6 +277,7 @@ void* handle_connection(void* arg) { std::string msg = timestamp + info; send(client_socket, msg.c_str(), strlen(msg.c_str()) + 1, 0); log("Sent new info to client " + std::to_string(client_socket)); + handndled_requests++; } else { log("Actual info already on client " + std::to_string(client_socket)); } @@ -263,6 +294,8 @@ void* draw(void* arg) { // Update info clear(); + printw("Use q + Enter to quit\n\n"); + // Print configuration printw( "LOG_FIFO_NAME=%s\nSERVER_TYPE=%s\nPORT=%i\nMAX_CONNECTIONS=%i\nCMD_LOG_BUFFER=%i\nCMD_REFRESH_TIME=%i\n\n", @@ -270,7 +303,7 @@ void* draw(void* arg) { ); // Print statistics - printw("Active connections: %i\nHandled messages: %i\nActive timers: %i\n", active_connections, handndled_requests, active_timer_threads); + printw("Active connections: %i\nHandled messages: %i\n", active_connections, handndled_requests); // Print logs for (int i = CMD_LOG_BUFFER-1; i >= 0; i--) { @@ -284,6 +317,24 @@ void* draw(void* arg) { } } +// Read commands from screen +void* commands(void* arg) { + // Cast server socket descriptor + int server_socket = *(int*)arg; + delete (int*)arg; + + while (true) { + std::string command; + std::cin >> command; + + if (command == "quit" || command == "exit" || command == "q") { + endwin(); + close(server_socket); + kill(0, 15); + } + } +} + int main() { init_ncurses(); init_log_pipe(); @@ -292,13 +343,23 @@ int main() { pthread_t tid; if (pthread_create(&tid, nullptr, &draw, nullptr) != 0) { std::cout << ("Failed to create drawing thread") << std::endl; - // endwin(); + endwin(); return 2; } pthread_detach(tid); - + int server_socket = start_socket(); + // Create thread to read commands + pthread_t tcid; + int* server_socket_copy = new int(server_socket); + if (pthread_create(&tcid, nullptr, &commands, server_socket_copy) != 0) { + std::cout << ("Failed to create commands thread") << std::endl; + endwin(); + return 2; + } + pthread_detach(tcid); + while (true) { int client_socket = accept(server_socket, nullptr, nullptr); diff --git a/server2/server b/server2/server index 93968c30b8cbefb350efbd31d07ff7944d867acc..a3d07bab03a52e0c9e06ccad4ecf22e227e06e52 100755 GIT binary patch literal 60560 zcmeIbd3==B^*{bhl3^1}P_Vd;ujD>XKx zGL5m+LaS9GGT&4o)<-#9j zKWAZ$2DQ71Cd{a%wQ*d^qqIpPo%qu)U;6P=Kfk@h|K~RkiOua;7CGwmf-^3&02Pvy_wJL%b{ zkAC5_YmXUsQ`7$Z>u0TK^sp!kcr>1K*^3SxX*LQ8oy$ZHTRqh8i{QsVin!nXXPRK^j-8ORSZ20%WsZ!}V z#l~(A*tAQYjr_B1=y#xFq$>AZICLudOdC1p!O>IkUv5*cNj7rc8JAkl-w#Pm|F@0* z^xD|}2^;#GHuNKHBoHeq!S%SK9Q`EE~Id zZR-0=oA#w~Bvrl2Z1~+a{qa2;ea70ZnN>vEE_rBx6$WR z^ows}mh*IoSDMCAI%YsV(Q{iku0t*ze?hx^o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F-vPe5j(S><<&lxZ@5zpeaok!<~YiY!0RqKF%n z|4bX5bfrs&wjy}?Qd#~Myst #include #include +#include +#include /* Configuration */ @@ -51,9 +53,6 @@ int active_connections = 0; // Total amount of handled requests int handndled_requests = 0; -// Amount of active timers for sending messages -int active_timer_threads = 0; - // Initializes ncurses lib void init_ncurses() { @@ -140,12 +139,43 @@ std::string get_mem_percent() { return "Physical memory: " + std::to_string(100 * (total_mem - free_mem)/total_mem) + "%\n"; } + +std::string get_vmem() { + std::ifstream meminfo("/proc/self/status"); + if(!meminfo) { + return "Error: failed to open /proc/meminfo\n"; + } + + std::string line; + long not_free_mem = -1, total_mem = -1; + + while((std::getline(meminfo, line))) { + if(line.find("VmRSS:") == 0) { + std::sscanf(line.c_str(), "VmRSS: %ld kB", ¬_free_mem); + } else if(line.find("VmSize:") == 0) { + std::sscanf(line.c_str(), "VmSize: %ld kB", &total_mem); + } + + if(not_free_mem != -1 && total_mem != -1) { + break; + } + } + + meminfo.close(); + + if(total_mem == -1 || not_free_mem == -1) { + return "Error: failed to read info from /proc/meminfo\n"; + } + + return "Virtual memory of the proccess: " + std::to_string(100.0 * not_free_mem/total_mem) + "%\n"; +} + // Returns message to send according to the server type std::string get_sysinfo() { if (SERVER_TYPE == "server1") { return '\t' + get_last_error() + "\t\t\t" + get_cursor_position(); } - return '\t' + get_mem_percent() + "\t\t\t" + "WIP\n"; // TODO: vmem + return '\t' + get_mem_percent() + "\t\t\t" + get_vmem(); // TODO: vmem } // Writes log message on screen and passes it to the logging pipe @@ -247,6 +277,7 @@ void* handle_connection(void* arg) { std::string msg = timestamp + info; send(client_socket, msg.c_str(), strlen(msg.c_str()) + 1, 0); log("Sent new info to client " + std::to_string(client_socket)); + handndled_requests++; } else { log("Actual info already on client " + std::to_string(client_socket)); } @@ -263,6 +294,8 @@ void* draw(void* arg) { // Update info clear(); + printw("Use q + Enter to quit\n\n"); + // Print configuration printw( "LOG_FIFO_NAME=%s\nSERVER_TYPE=%s\nPORT=%i\nMAX_CONNECTIONS=%i\nCMD_LOG_BUFFER=%i\nCMD_REFRESH_TIME=%i\n\n", @@ -270,7 +303,7 @@ void* draw(void* arg) { ); // Print statistics - printw("Active connections: %i\nHandled messages: %i\nActive timers: %i\n", active_connections, handndled_requests, active_timer_threads); + printw("Active connections: %i\nHandled messages: %i\n", active_connections, handndled_requests); // Print logs for (int i = CMD_LOG_BUFFER-1; i >= 0; i--) { @@ -284,6 +317,24 @@ void* draw(void* arg) { } } +// Read commands from screen +void* commands(void* arg) { + // Cast server socket descriptor + int server_socket = *(int*)arg; + delete (int*)arg; + + while (true) { + std::string command; + std::cin >> command; + + if (command == "quit" || command == "exit" || command == "q") { + endwin(); + close(server_socket); + kill(0, 15); + } + } +} + int main() { init_ncurses(); init_log_pipe(); @@ -292,13 +343,23 @@ int main() { pthread_t tid; if (pthread_create(&tid, nullptr, &draw, nullptr) != 0) { std::cout << ("Failed to create drawing thread") << std::endl; - // endwin(); + endwin(); return 2; } pthread_detach(tid); - + int server_socket = start_socket(); + // Create thread to read commands + pthread_t tcid; + int* server_socket_copy = new int(server_socket); + if (pthread_create(&tcid, nullptr, &commands, server_socket_copy) != 0) { + std::cout << ("Failed to create commands thread") << std::endl; + endwin(); + return 2; + } + pthread_detach(tcid); + while (true) { int client_socket = accept(server_socket, nullptr, nullptr);