summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-18 13:07:22 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-18 13:07:22 +0800
commit1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a (patch)
treeaaa5ee633850dfa64d05bccc251c4f08d8efce93
parent0f7ab3bfa1a3e76b14b0824a3e5c8938c6b3930f (diff)
downloadpttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.tar
pttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.tar.gz
pttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.tar.bz2
pttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.tar.lz
pttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.tar.xz
pttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.tar.zst
pttbbs-1f43a24f4630f45fa1ba7f8dec86409a5d9ec87a.zip
remove unneseccery barrier of poll closing
remove convertion from old style filename of vote system FIXME comment in assess git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2338 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h2
-rw-r--r--mbbsd/assess.c2
-rw-r--r--mbbsd/mbbsd.c7
-rw-r--r--mbbsd/vote.c38
4 files changed, 28 insertions, 21 deletions
diff --git a/include/proto.h b/include/proto.h
index ae0174db..a28e33ff 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -659,7 +659,7 @@ void b_suckinfile(FILE *fp, char *fname);
int b_results(void);
int b_vote(void);
int b_vote_maintain(void);
-int b_closepolls(void);
+void auto_close_polls(void);
/* vice */
int vice_main(void);
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index 562e3ac8..489054d4 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -14,6 +14,8 @@ inline static void inc(unsigned char *num, int n)
(*num) += n;
}
+/* FIXME race occurs when he's online.
+ * passwd_update in mbbsd.c:u_exit() override the later value. */
#define modify_column(name) \
int inc_##name(char *userid, int num) \
{ \
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 090c887a..ee606059 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1048,13 +1048,8 @@ start_client()
login_query(); /* Ptt login time out */
m_init(); /* init the user mail path */
user_login();
+ auto_close_polls(); /* 笆秨布 */
- if (now - SHM->close_vote_time > 86400)
- //эぱΩ
- {
- b_closepolls();
- SHM->close_vote_time = now;
- }
Signal(SIGALRM, SIG_IGN);
domenu(MMENU, "\", (currutmp->mailalert ? 'M' : 'C'), cmdlist);
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 1268f16f..493858b1 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -24,7 +24,7 @@ typedef struct {
char title[sizeof("vtitleXX\0")];
} vote_buffer_t;
-#if 1 // convert the filenames of first vote
+#if 0 // convert the filenames of first vote
void convert_first_vote(boardheader_t *fhp)
{
const char *filename[] = {
@@ -369,6 +369,7 @@ b_result(vote_buffer_t *vbuf, boardheader_t * fh)
static int
b_close(boardheader_t * fh, vote_buffer_t *vbuf)
{
+#if 0
// XXX what's it for ?
if (fh->bvote == 2) {
if (fh->vtime < now - 3 * 86400) {
@@ -377,25 +378,26 @@ b_close(boardheader_t * fh, vote_buffer_t *vbuf)
} else
return 0;
}
+#endif
b_result(vbuf, fh);
return 1;
}
-int
+static int
b_closepolls()
{
- char *fn_vote_polling = ".polling";
boardheader_t *fhp;
- FILE *cfp;
int pos, dirty;
- time_t last;
- char timebuf[100];
vote_buffer_t vbuf;
- /* Edited by CharlieL for can't auto poll bug */
-
+#ifndef BARRIER_HAS_BEEN_IN_SHM
+ char *fn_vote_polling = ".polling";
+ time_t last;
+ FILE *cfp;
+ /* XXX necessary to lock ? */
if ((cfp = fopen(fn_vote_polling, "r"))) {
- fgets(timebuf, 100 * sizeof(char), cfp);
+ char timebuf[100];
+ fgets(timebuf, sizeof(timebuf), cfp);
sscanf(timebuf, "%lu", &last);
fclose(cfp);
if (last + 3600 >= now)
@@ -405,6 +407,7 @@ b_closepolls()
return 0;
fprintf(cfp, "%lu\n%s\n", now, ctime(&now));
fclose(cfp);
+#endif
dirty = 0;
for (fhp = bcache, pos = 1; pos <= numboards; fhp++, pos++) {
@@ -420,6 +423,16 @@ b_closepolls()
return 0;
}
+void
+auto_close_polls(void)
+{
+ /* 程ぱ秨布Ω */
+ if (now - SHM->close_vote_time > 86400) {
+ b_closepolls();
+ SHM->close_vote_time = now;
+ }
+}
+
static int
vote_view(vote_buffer_t *vbuf, char *bname, int vote_index)
{
@@ -597,12 +610,9 @@ vote_maintain(char *bname)
stand_title("羭快щ布");
fhp = bcache + pos - 1;
- if (fhp->bvote < 0)
- fhp->bvote = 0;
-
if (fhp->bvote != 0) {
-#if 1 // convert the filenames of first vote
+#if 0 // convert the filenames of first vote
convert_first_vote(fhp);
#endif
getdata(b_lines - 1, 0,
@@ -1017,7 +1027,7 @@ user_vote(char *bname)
vmsg("ヘ玡⊿Τヴщ布羭︽");
return FULLUPDATE;
}
-#if 1 // convert the filenames of first vote
+#if 0 // convert the filenames of first vote
convert_first_vote(fhp);
#endif
if (!HAS_PERM(PERM_LOGINOK)) {