diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-03-24 10:34:06 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-03-24 10:34:06 +0800 |
commit | 5926c9effdfd630fadd4b12a02505815e2aa5122 (patch) | |
tree | a5544a07ffa7cc1c3e6fdf3a129d6d0598fbf102 | |
parent | 2ebc1d6719fc7d7be7415b67667ed8a78f04b0c2 (diff) | |
download | pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.tar pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.tar.gz pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.tar.bz2 pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.tar.lz pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.tar.xz pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.tar.zst pttbbs-5926c9effdfd630fadd4b12a02505815e2aa5122.zip |
Remove reportv1.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5821 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/daemon/angelbeats/angelbeats.c | 35 | ||||
-rw-r--r-- | pttbbs/include/daemons.h | 22 |
2 files changed, 17 insertions, 40 deletions
diff --git a/pttbbs/daemon/angelbeats/angelbeats.c b/pttbbs/daemon/angelbeats/angelbeats.c index be679eb6..1971fa59 100644 --- a/pttbbs/daemon/angelbeats/angelbeats.c +++ b/pttbbs/daemon/angelbeats/angelbeats.c @@ -16,8 +16,9 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -------------------------------------------------------------------------- -// TODO cache report results. +// TODO cache global report results. // TODO add blame records +// TODO calculate suggest rate per hour #include <stdio.h> #include <stdlib.h> @@ -580,9 +581,19 @@ void load_state_data() { if (!kanade) continue; kanade->last_activity = activity; - if (assigned > kanade->last_assigned) { - log("warn: angel state data inconsistent with passwd: %s\n", - kanade->userid); + // Update last_assigned* if the master has changed angel. + if (!kanade->last_assigned_master) { + kanade->last_assigned = assigned; + kanade->last_assigned_master = assigned_master; + } else if (assigned > kanade->last_assigned && + kanade->last_assigned_master != assigned_master) { + const char *uid1 = getuserid(kanade->last_assigned_master), + *uid2 = getuserid(assigned_master); + if (!uid1) uid1 = "(unknown)"; + if (!uid2) uid2 = "(unknown)"; + log("warn: angel state data inconsistent with passwd: %s " + "(master: [pw]%s vs [state]%s)\n", + kanade->userid, uid1, uid2); kanade->last_assigned = assigned; kanade->last_assigned_master = assigned_master; } @@ -758,22 +769,6 @@ client_cb(int fd, short event, void *arg) { goto end; } break; - // TODO remove report1. - case ANGELBEATS_REQ_REPORT1: - log("%s angel [%s] request for report v1\n", - Cdatelite(&clk), master_uid); - { - angel_beats_report rpt = {0}; - assert(sizeof(angel_beats_report_v1) < - sizeof(angel_beats_report)); - rpt.cb = sizeof(rpt); - create_angel_report(data.angel_uid, &rpt); - rpt.cb = sizeof(angel_beats_report_v1); - // write different kind of data! - write(fd, &rpt, rpt.cb); - goto end; - } - break; case ANGELBEATS_REQ_GET_ONLINE_LIST: log("%s get_online_uid_list\n", Cdatelite(&clk)); { diff --git a/pttbbs/include/daemons.h b/pttbbs/include/daemons.h index 6ad6299c..823b2204 100644 --- a/pttbbs/include/daemons.h +++ b/pttbbs/include/daemons.h @@ -66,7 +66,7 @@ typedef struct login_data enum ANGELBEATS_OPERATIONS { ANGELBEATS_REQ_INVALID = 0, - ANGELBEATS_REQ_REPORT1, + ANGELBEATS_REQ_REPORT, ANGELBEATS_REQ_RELOAD, ANGELBEATS_REQ_SUGGEST, ANGELBEATS_REQ_SUGGEST_AND_LINK, @@ -77,7 +77,7 @@ enum ANGELBEATS_OPERATIONS { ANGELBEATS_REQ_REG_NEW, ANGELBEATS_REQ_BLAME, ANGELBEATS_REQ_SAVE_STATE, - ANGELBEATS_REQ_REPORT, + ANGELBEATS_REQ_MAX, }; typedef struct { @@ -93,20 +93,6 @@ typedef struct { short total_angels; short total_online_angels; short total_active_angels; - short min_masters_of_online_angels; - short max_masters_of_online_angels; - short min_masters_of_active_angels; - short max_masters_of_active_angels; - short my_index; - short my_active_index; - short my_active_masters; -} angel_beats_report_v1 ; - -typedef struct { - short cb; - short total_angels; - short total_online_angels; - short total_active_angels; short min_masters_of_online_angels; short max_masters_of_online_angels; @@ -121,10 +107,6 @@ typedef struct { time4_t last_assigned; time4_t reserved; int last_assigned_master; -#if 0 - time4_t max_inactive_time; - time4_t max_unassigned_time; -#endif } angel_beats_report ; |