comparison src/director/user-directory.h @ 22676:c9549bea9106

director: Don't send USERs in handshake that were already sent between handshake If the user was refreshed since the handshake was started, it means that the same user was already sent to the other side (added to the stream immediately after it was received/handled). There's no need to send it again. This fixes a potentally infinite handshake when users are rapidly changing and the handshake iterator never sees the end of the list. (Each refreshed user is moved to the end of the list, so handshaking can keep sending the same user over and over again.)
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sat, 25 Nov 2017 10:01:31 +0200
parents 867c3905ac0b
children
comparison
equal deleted inserted replaced
22675:d689d7d99b4f 22676:c9549bea9106
60 struct user *user); 60 struct user *user);
61 bool user_directory_user_is_near_expiring(struct user_directory *dir, 61 bool user_directory_user_is_near_expiring(struct user_directory *dir,
62 struct user *user); 62 struct user *user);
63 63
64 /* Iterate through users in the directory. It's safe to modify user directory 64 /* Iterate through users in the directory. It's safe to modify user directory
65 while iterators are running. The moved/removed users will just be skipped 65 while iterators are running. The removed users will just be skipped over.
66 over. */ 66 Users that are refreshed (= moved to end of list) may be processed twice.
67
68 Using iter_until_current_tail=TRUE causes the iterator to not iterate
69 through any users that were added/refreshed since the iteration began.
70 Note that this may skip some users entirely. */
67 struct user_directory_iter * 71 struct user_directory_iter *
68 user_directory_iter_init(struct user_directory *dir); 72 user_directory_iter_init(struct user_directory *dir,
73 bool iter_until_current_tail);
69 struct user *user_directory_iter_next(struct user_directory_iter *iter); 74 struct user *user_directory_iter_next(struct user_directory_iter *iter);
70 void user_directory_iter_deinit(struct user_directory_iter **iter); 75 void user_directory_iter_deinit(struct user_directory_iter **iter);
71 76
72 #endif 77 #endif