summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-08-28 02:08:42 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-08-28 02:08:42 +0800
commit0a87c49c19fa1563d3e7dae9338a90fdd084ccd7 (patch)
treea15b37483a057eef2d2356c103f815ef319d4cf6 /mbbsd/mbbsd.c
parent0c10e6fe28cb276ab030683eb4685c36e0facba7 (diff)
downloadpttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.tar
pttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.tar.gz
pttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.tar.bz2
pttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.tar.lz
pttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.tar.xz
pttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.tar.zst
pttbbs-0a87c49c19fa1563d3e7dae9338a90fdd084ccd7.zip
overload message
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@499 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index fb4917c1..9990357d 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.52 2002/08/24 19:43:07 kcwu Exp $ */
+/* $Id: mbbsd.c,v 1.53 2002/08/27 18:08:42 in2 Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -510,26 +510,29 @@ login_query()
char uid[IDLEN + 1], passbuf[PASSLEN];
int attempts;
char genbuf[200];
- attach_SHM();
+ //attach_SHM();
resolve_garbage();
now = time(0);
attempts = SHM->UTMPnumber;
-#ifdef DEBUG
- move(1, 0);
- prints("debugging mode\ncurrent pid: %d\n", getpid());
-#else
- show_file("etc/Welcome", 1, -1, NO_RELOAD);
-#endif
- output("1", 1);
if (attempts >= MAX_ACTIVE
#ifdef DYMAX_ACTIVE
|| (GLOBALVAR[9] > 1000 && attempts >= GLOBALVAR[9] )
#endif
) {
+ ++GLOBALVAR[8];
outs("由於人數太多,請您稍後再來。\n");
refresh();
exit(1);
}
+
+#ifdef DEBUG
+ move(1, 0);
+ prints("debugging mode\ncurrent pid: %d\n", getpid());
+#else
+ show_file("etc/Welcome", 1, -1, NO_RELOAD);
+#endif
+ output("1", 1);
+
/* hint */
attempts = 0;
@@ -1263,6 +1266,8 @@ daemon_login(int argc, char *argv[], char *envp[])
fprintf(fp, "%d\n", getpid());
fclose(fp);
}
+
+ attach_SHM();
/* main loop */
for (;;) {
len_of_sock_addr = sizeof(xsin);
@@ -1315,6 +1320,10 @@ check_ban_and_load(int fd)
* sec */
static int banned = 0;
+#ifdef INSCREEN
+ write(fd, INSCREEN, strlen(INSCREEN));
+#endif
+
if ((time(0) - chkload_time) > 1) {
overload = chkload(buf, sizeof(buf));
banned = !access(BBSHOME "/BAN", R_OK) &&
@@ -1328,12 +1337,19 @@ check_ban_and_load(int fd)
write(fd, buf, strlen(buf));
fclose(fp);
}
+ if (SHM->UTMPnumber >= MAX_ACTIVE
+#ifdef DYMAX_ACTIVE
+ || (GLOBALVAR[9] > 500 && SHM->UTMPnumber >= GLOBALVAR[9] )
+#endif
+ ) {
+ ++GLOBALVAR[8];
+ snprintf(buf, sizeof(buf), "由於人數過多,請您稍後再來。");
+ write(fd, buf, strlen(buf));
+ overload = 1;
+ }
+
if (banned || overload)
return -1;
-#ifdef INSCREEN
- write(fd, INSCREEN, strlen(INSCREEN));
-#endif
-
return 0;
}