diff options
author | Jeffrey Hutzelman <jhutz@cmu.edu> | 2013-01-04 16:33:59 -0500 |
---|---|---|
committer | Jeffrey Hutzelman <jhutz@cmu.edu> | 2013-02-17 22:34:40 -0500 |
commit | 3923d414d0408e2f33dff220c5964b36e28565ba (patch) | |
tree | 43c7518b25eb340cc1a41e6c4d017507ac893046 /server/server.c | |
parent | 854948b8a897cfc2791c8823922b4600668445b1 (diff) |
Make otherrealms be an array of pointers
The server keeps pointers to realms in non-ephemeral data structures, such
as triplet subscriber lists. Thus, we cannot move existing realms around
in memory without causing data corruption. However, dynamic reloading of
the realm.list means new realms can appear, which sooner or later will
mean reallocating the otherrealms array to make room for more realms.
Therefore, to allow otherrealms to be reallocated without changing the
addresses of existing realms, otherrealms is converted from an array of
realms to an array of pointers to realms.
Diffstat (limited to 'server/server.c')
-rw-r--r-- | server/server.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/server.c b/server/server.c index 88d2555..2983cf6 100644 --- a/server/server.c +++ b/server/server.c @@ -760,7 +760,8 @@ send_stats(struct sockaddr_in *who) otherservers[i].dumping ? " (DUMPING)" : ""); responses[num_resp++] = strsave(buf); } - for (realm = otherrealms, i = 0; i < nrealms ; i++, realm++) { + for (i = 0; i < nrealms ; i++) { + realm = otherrealms[i]; sprintf(buf, "%s(%s)/%s", realm->name, inet_ntoa((realm->srvrs[realm->idx].addr).sin_addr), rlm_states[(int) realm->state]); |