mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-06-17 22:00:52 +00:00
reduce scope of some variables
reduce scope of R in Monitor reduce scope of Temp in TCPSendRaw reduce scope of Temp in TCPSend
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
std::string StatReport;
|
std::string StatReport;
|
||||||
int PPS = 0;
|
int PPS = 0;
|
||||||
void Monitor() {
|
void Monitor() {
|
||||||
int R, C = 0, V = 0;
|
int C = 0, V = 0;
|
||||||
if (CI->Clients.empty()) {
|
if (CI->Clients.empty()) {
|
||||||
StatReport = "-";
|
StatReport = "-";
|
||||||
return;
|
return;
|
||||||
@@ -27,7 +27,7 @@ void Monitor() {
|
|||||||
if (C == 0 || PPS == 0) {
|
if (C == 0 || PPS == 0) {
|
||||||
StatReport = "-";
|
StatReport = "-";
|
||||||
} else {
|
} else {
|
||||||
R = (PPS / C) / V;
|
int R = (PPS / C) / V;
|
||||||
StatReport = std::to_string(R);
|
StatReport = std::to_string(R);
|
||||||
}
|
}
|
||||||
PPS = 0;
|
PPS = 0;
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
bool TCPSendRaw(SOCKET C, char* Data, int32_t Size) {
|
bool TCPSendRaw(SOCKET C, char* Data, int32_t Size) {
|
||||||
int64_t Sent = 0, Temp;
|
int64_t Sent = 0;
|
||||||
do {
|
do {
|
||||||
Temp = send(C, &Data[Sent], int(Size - Sent), 0);
|
int64_t Temp = send(C, &Data[Sent], int(Size - Sent), 0);
|
||||||
if (Temp < 1) {
|
if (Temp < 1) {
|
||||||
info("Socket Closed! " + std::to_string(C));
|
info("Socket Closed! " + std::to_string(C));
|
||||||
CloseSocketProper(C);
|
CloseSocketProper(C);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ bool TCPSend(Client* c, const std::string& Data) {
|
|||||||
if (c == nullptr)
|
if (c == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int32_t Size, Sent, Temp;
|
int32_t Size, Sent;
|
||||||
std::string Send(4, 0);
|
std::string Send(4, 0);
|
||||||
Size = int32_t(Data.size());
|
Size = int32_t(Data.size());
|
||||||
memcpy(&Send[0], &Size, sizeof(Size));
|
memcpy(&Send[0], &Size, sizeof(Size));
|
||||||
@@ -25,7 +25,7 @@ bool TCPSend(Client* c, const std::string& Data) {
|
|||||||
Sent = 0;
|
Sent = 0;
|
||||||
Size += 4;
|
Size += 4;
|
||||||
do {
|
do {
|
||||||
Temp = send(c->GetTCPSock(), &Send[Sent], Size - Sent, 0);
|
int32_t Temp = send(c->GetTCPSock(), &Send[Sent], Size - Sent, 0);
|
||||||
if (Temp == 0) {
|
if (Temp == 0) {
|
||||||
if (c->GetStatus() > -1)
|
if (c->GetStatus() > -1)
|
||||||
c->SetStatus(-1);
|
c->SetStatus(-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user