From 4616cab55586756a3f6ba82ca18c7737cf026fa9 Mon Sep 17 00:00:00 2001 From: DanArmor <39347109+DanArmor@users.noreply.github.com> Date: Fri, 10 Mar 2023 20:02:34 +0300 Subject: [PATCH] fix: session gui fix --- src/mailserver.c | 8 ++++---- src/util.c | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mailserver.c b/src/mailserver.c index eecb54a..60f02b0 100644 --- a/src/mailserver.c +++ b/src/mailserver.c @@ -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"); @@ -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){ @@ -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(); diff --git a/src/util.c b/src/util.c index 97c1a32..15fab8e 100644 --- a/src/util.c +++ b/src/util.c @@ -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){ @@ -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); @@ -137,7 +141,9 @@ void StopProcessingClient(LocalThreadInfo *lThInfo){ } CloseHandle(lThInfo->threadInfo.handle); UNLOCK_TH(); + LoadThreadList(); + DisplaySession(); } int ReadUntilCRLF(SOCKET sock, char *buff, int *size){