Skip to content

Commit

Permalink
fix: session gui fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DanArmor committed Mar 10, 2023
1 parent 10415f5 commit 4616cab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mailserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ int main(int argc, char **argv){
glGUIThreadList = IupList(NULL);
IupSetAttribute(glGUIThreadList, "NAME", "LST_THREAD");
IupSetAttribute(glGUIThreadList, "EXPAND", "NO");
IupSetAttribute(glGUIThreadList, "SIZE", "100x");
IupSetAttribute(glGUIThreadList, "VISIBLELINES", "6");
IupSetAttribute(glGUIThreadList, "MINSIZE", "150x");
IupSetAttribute(glGUIThreadList, "VISIBLELINES", "16");

glGUISessionText = IupText(NULL);
IupSetAttribute(glGUISessionText, "READONLY", "YES");
Expand Down Expand Up @@ -182,7 +182,7 @@ int main(int argc, char **argv){
// новые соединения

LOCK_OUT();
printf("Waiting for all threads to terminate. . . 2000ms for each connection. . .\n");
printf("Waiting for all threads to terminate. . . 1000ms for each connection. . .\n");
UNLOCK_OUT();
int foundRunning = 0;
while(1){
Expand All @@ -191,7 +191,7 @@ int main(int argc, char **argv){
if(glPool[i].isFree == 0){
UNLOCK_TH();
foundRunning = 1;
if(WaitForSingleObject(glPool[i].handle, 2000) == WAIT_TIMEOUT){
if(WaitForSingleObject(glPool[i].handle, 1000) == WAIT_TIMEOUT){
LOCK_TH();
closesocket(glPool[i].client);
UNLOCK_TH();
Expand Down
6 changes: 6 additions & 0 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ void InitLocalThreadInfo(LocalThreadInfo *lThInfo, ServerThread *thInfo, int pro

InitSessionLog(lThInfo);

WriteToSession(&lThInfo->sessionLog, "======START OF SESSION======\015\012", 30);

UNLOCK_TH();

LoadThreadList();
DisplaySession();
}

void MigrateDeadSession(SessionLog *sessionLog){
Expand All @@ -115,6 +118,7 @@ void StopProcessingClient(LocalThreadInfo *lThInfo){
PLTH_REPORT(lThInfo, "Terminating.\nBuffer data:\n===\n%s===\n", lThInfo->buff);

lThInfo->sessionLog.isDead = 1;
WriteToSession(&lThInfo->sessionLog, "======END OF SESSION======\015\012", 28);
MigrateDeadSession(&lThInfo->sessionLog);
closesocket(lThInfo->pthreadInfo->client);
free(lThInfo->buff);
Expand All @@ -137,7 +141,9 @@ void StopProcessingClient(LocalThreadInfo *lThInfo){
}
CloseHandle(lThInfo->threadInfo.handle);
UNLOCK_TH();

LoadThreadList();
DisplaySession();
}

int ReadUntilCRLF(SOCKET sock, char *buff, int *size){
Expand Down

0 comments on commit 4616cab

Please sign in to comment.