struct director *dir;
};
-static void notify_connection_input(struct notify_connection *conn)
+static void notify_update_user(struct director *dir, const char *username,
+ unsigned int username_hash)
{
struct user *user;
+ int diff;
+
+ user = user_directory_lookup(dir->users, username_hash);
+ if (user == NULL)
+ return;
+
+ diff = ioloop_time - user->timestamp;
+ if (diff >= (int)dir->set->director_user_expire) {
+ i_warning("notify: User %s refreshed too late (%d secs)",
+ username, diff);
+ }
+ user_directory_refresh(dir->users, user);
+ director_update_user(dir, dir->self_host, user);
+}
+
+static void notify_connection_input(struct notify_connection *conn)
+{
const char *line;
unsigned int hash;
- int diff;
while ((line = i_stream_read_next_line(conn->input)) != NULL) {
hash = user_directory_get_username_hash(conn->dir->users, line);
- user = user_directory_lookup(conn->dir->users, hash);
- if (user != NULL) {
- diff = ioloop_time - user->timestamp;
- if (diff >= (int)conn->dir->set->director_user_expire) {
- i_warning("notify: User %s refreshed too late "
- "(%d secs)", line, diff);
- }
- user_directory_refresh(conn->dir->users, user);
- director_update_user(conn->dir, conn->dir->self_host,
- user);
- }
+ notify_update_user(conn->dir, line, hash);
}
if (conn->input->eof) {
i_error("notify: read() unexpectedly returned EOF");