]>
Commit | Line | Data |
---|---|---|
1 | # HG changeset patch | |
2 | # Parent d5b15de617d54c694b84bd32b96cdb5e88491a9f | |
3 | ||
4 | diff -r d5b15de617d5 include/client.h | |
5 | --- a/include/client.h Sun Jul 14 17:56:54 2013 +0100 | |
6 | +++ b/include/client.h Sun Jul 14 18:05:01 2013 +0100 | |
7 | @@ -257,7 +257,7 @@ | |
8 | server, XXX if this is a user */ | |
9 | time_t cli_firsttime; /**< time client was created */ | |
10 | time_t cli_lastnick; /**< TimeStamp on nick */ | |
11 | - int cli_marker; /**< /who processing marker */ | |
12 | + unsigned int cli_marker; /**< processing marker */ | |
13 | struct Flags cli_flags; /**< client flags */ | |
14 | unsigned int cli_hopcount; /**< number of servers to this 0 = local */ | |
15 | struct irc_in_addr cli_ip; /**< Real IP of client */ | |
16 | @@ -774,6 +774,7 @@ | |
17 | struct Connection** con_p); | |
18 | extern void client_set_privs(struct Client *client, struct ConfItem *oper); | |
19 | extern int client_report_privs(struct Client* to, struct Client* client); | |
20 | +extern unsigned int get_client_marker(void); | |
21 | ||
22 | #endif /* INCLUDED_client_h */ | |
23 | ||
24 | diff -r d5b15de617d5 ircd/client.c | |
25 | --- a/ircd/client.c Sun Jul 14 17:56:54 2013 +0100 | |
26 | +++ b/ircd/client.c Sun Jul 14 18:05:01 2013 +0100 | |
27 | @@ -264,3 +264,24 @@ | |
28 | ||
29 | return 0; | |
30 | } | |
31 | + | |
32 | +/* | |
33 | + * A little spin-marking utility to tell us which clients we have already | |
34 | + * processed and which not | |
35 | + */ | |
36 | +unsigned int get_client_marker(void) | |
37 | +{ | |
38 | + static unsigned int marker = 0; | |
39 | + | |
40 | + if (!++marker) | |
41 | + { | |
42 | + struct Client *cptr; | |
43 | + for (cptr=GlobalClientList;cptr;cptr=cli_next(cptr)) | |
44 | + { | |
45 | + cli_marker(cptr) = 0; | |
46 | + } | |
47 | + marker++; | |
48 | + } | |
49 | + | |
50 | + return marker; | |
51 | +} | |
52 | diff -r d5b15de617d5 ircd/m_who.c | |
53 | --- a/ircd/m_who.c Sun Jul 14 17:56:54 2013 +0100 | |
54 | +++ b/ircd/m_who.c Sun Jul 14 18:05:01 2013 +0100 | |
55 | @@ -99,26 +99,6 @@ | |
56 | /* #include <assert.h> -- Now using assert in ircd_log.h */ | |
57 | #include <string.h> | |
58 | ||
59 | - | |
60 | -/* | |
61 | - * A little spin-marking utility to tell us which clients we have already | |
62 | - * processed and which not | |
63 | - */ | |
64 | -static int who_marker = 0; | |
65 | -static void move_marker(void) | |
66 | -{ | |
67 | - if (!++who_marker) | |
68 | - { | |
69 | - struct Client *cptr = GlobalClientList; | |
70 | - while (cptr) | |
71 | - { | |
72 | - cli_marker(cptr) = 0; | |
73 | - cptr = cli_next(cptr); | |
74 | - } | |
75 | - who_marker++; | |
76 | - } | |
77 | -} | |
78 | - | |
79 | #define CheckMark(x, y) ((x == y) ? 0 : (x = y)) | |
80 | #define Process(cptr) CheckMark(cli_marker(cptr), who_marker) | |
81 | ||
82 | @@ -155,6 +135,7 @@ | |
83 | char *p; /* Scratch char pointer */ | |
84 | char *qrt; /* Pointer to the query type */ | |
85 | static char mymask[512]; /* To save the mask before corrupting it */ | |
86 | + unsigned int who_marker; /* Used to mark clients we've touched */ | |
87 | ||
88 | /* Let's find where is our mask, and if actually contains something */ | |
89 | mask = ((parc > 1) ? parv[1] : 0); | |
90 | @@ -309,7 +290,7 @@ | |
91 | counter = (2048 / (counter + 4)); | |
92 | if (mask && (strlen(mask) > 510)) | |
93 | mask[510] = '\0'; | |
94 | - move_marker(); | |
95 | + who_marker = get_client_marker(); | |
96 | commas = (mask && strchr(mask, ',')); | |
97 | ||
98 | /* First treat mask as a list of plain nicks/channels */ |