auth: enable soft reject of clients.
This doesn't cancel callbacks in progress. This is useful in cases where you're not sure you want to reject a client yet.
This commit is contained in:
parent
df32819e04
commit
91f870b39b
2 changed files with 10 additions and 9 deletions
|
@ -83,7 +83,7 @@ void destroy_providers(void)
|
|||
{
|
||||
/* TBD - is this the right thing?
|
||||
* (NOTE - this error message is designed for morons) */
|
||||
reject_client(&auth_clients[i], 0,
|
||||
reject_client(&auth_clients[i], 0, true,
|
||||
"IRC server reloading... try reconnecting in a few seconds");
|
||||
}
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ void provider_done(struct auth_client *auth, provider_t id)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reject a client, cancel outstanding providers if any */
|
||||
void reject_client(struct auth_client *auth, provider_t id, const char *reason)
|
||||
/* Reject a client, cancel outstanding providers if any if hard set to true */
|
||||
void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason)
|
||||
{
|
||||
uint16_t cid = auth->cid;
|
||||
char reject;
|
||||
|
@ -165,10 +165,11 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason)
|
|||
|
||||
unset_provider(auth, id);
|
||||
|
||||
if(auth->providers)
|
||||
if(hard && auth->providers)
|
||||
{
|
||||
cancel_providers(auth);
|
||||
|
||||
memset(&auth_clients[cid], 0, sizeof(struct auth_client));
|
||||
memset(&auth_clients[cid], 0, sizeof(struct auth_client));
|
||||
}
|
||||
}
|
||||
|
||||
/* Accept a client, cancel outstanding providers if any */
|
||||
|
|
|
@ -82,9 +82,9 @@ void init_providers(void);
|
|||
void destroy_providers(void);
|
||||
void cancel_providers(struct auth_client *auth);
|
||||
|
||||
void provider_done(struct auth_client *auth, provider_t provider);
|
||||
void reject_client(struct auth_client *auth, provider_t provider, const char *reason);
|
||||
void accept_client(struct auth_client *auth, provider_t provider);
|
||||
void provider_done(struct auth_client *auth, provider_t id);
|
||||
void accept_client(struct auth_client *auth, provider_t id);
|
||||
void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason);
|
||||
|
||||
void notice_client(struct auth_client *auth, const char *notice);
|
||||
|
||||
|
|
Loading…
Reference in a new issue