summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
931cbc3)
рефакторинг кода, добавлена инициализация некоторых членов, уменьшена
область видимости переменных
listenSocket(0),
outerSocket(0),
refreshPeriod(0),
listenSocket(0),
outerSocket(0),
refreshPeriod(0),
- listenWebAddr(0),
- outerAddrLen(0)
{
#ifdef WIN32
res = WSAStartup(MAKEWORD(2,0), &wsaData);
{
#ifdef WIN32
res = WSAStartup(MAKEWORD(2,0), &wsaData);
void WEB::PrepareNet()
{
listenSocket = socket(PF_INET, SOCK_STREAM, 0);
void WEB::PrepareNet()
{
listenSocket = socket(PF_INET, SOCK_STREAM, 0);
+
+struct sockaddr_in listenAddr;
listenAddr.sin_family = AF_INET;
listenAddr.sin_port = htons(LISTEN_PORT);
listenAddr.sin_addr.s_addr = listenWebAddr;
listenAddr.sin_family = AF_INET;
listenAddr.sin_port = htons(LISTEN_PORT);
listenAddr.sin_addr.s_addr = listenWebAddr;
printf("Listen failed.\n");
exit(0);
}
printf("Listen failed.\n");
exit(0);
}
-
-outerAddrLen = sizeof(outerAddr);
}
//---------------------------------------------------------------------------
void WEB::SetRefreshPagePeriod(int p)
}
//---------------------------------------------------------------------------
void WEB::SetRefreshPagePeriod(int p)
char recvBuffer[4096];
while (1)
{
char recvBuffer[4096];
while (1)
{
+ struct sockaddr_in outerAddr;
+
+ #ifndef WIN32
+ socklen_t outerAddrLen = sizeof(outerAddr);
+ #else
+ int outerAddrLen = sizeof(outerAddr);
+ #endif
+
outerSocket = accept(listenSocket, (struct sockaddr*)&outerAddr, &outerAddrLen);
if (outerSocket == -1)
{
outerSocket = accept(listenSocket, (struct sockaddr*)&outerAddr, &outerAddrLen);
if (outerSocket == -1)
{
void UpdateStat(const LOADSTAT & ls);
void Start();
private:
void UpdateStat(const LOADSTAT & ls);
void Start();
private:
+ int SendReply();
+ int SendCSS();
+ int Redirect(const char * url);
#ifdef WIN32
WSADATA wsaData;
#ifdef WIN32
WSADATA wsaData;
- int SendReply();
- int SendCSS();
- int Redirect(const char * url);
-
- string dirName[DIR_NUM];
- int res;
- int listenSocket;
- int outerSocket;
- struct sockaddr_in listenAddr;
- struct sockaddr_in outerAddr;
- int refreshPeriod;
+ string dirName[DIR_NUM];
+ int res;
+ int listenSocket;
+ int outerSocket;
+ int refreshPeriod;
- uint32_t listenWebAddr;
- LOADSTAT ls;
+ uint32_t listenWebAddr;
+ LOADSTAT ls;
list<STG_MESSAGE> messages;
list<STG_MESSAGE> messages;
-
- #ifndef WIN32
- socklen_t outerAddrLen;
- #else
- int outerAddrLen;
- #endif
};
//-----------------------------------------------------------------------------
};
//-----------------------------------------------------------------------------