ptr->host, ptr->port));
if (server->server_type == SILC_ROUTER && ptr->backup_router &&
- ptr->initiator == FALSE && !server->backup_router)
+ ptr->initiator == FALSE && !server->backup_router &&
+ !silc_server_config_get_backup_router(server))
server->wait_backup = TRUE;
if (ptr->initiator) {
if (backup_local)
ctx->conn_type = SILC_SOCKET_TYPE_SERVER;
new_server->server_type = SILC_BACKUP_ROUTER;
+
+ /* Remove the backup waiting with timeout */
+ silc_schedule_task_add(server->schedule, 0,
+ silc_server_backup_router_wait,
+ (void *)server, 5, 0,
+ SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
}
/* Statistics */
SILC_LOG_DEBUG(("Connection is disabled"));
goto out;
}
+ if (ret != SILC_PACKET_HEARTBEAT &&
+ idata && idata->status & SILC_IDLIST_STATUS_DISABLED) {
+ SILC_LOG_DEBUG(("Connection is disabled"));
+ goto out;
+ }
if (ret == SILC_PACKET_NONE) {
SILC_LOG_DEBUG(("Error parsing packet"));
{
FreeClientInternal i = (FreeClientInternal)context;
+ assert(!silc_hash_table_count(i->client->channels));
+
silc_idlist_del_data(i->client);
silc_idcache_purge_by_context(i->server->local_list->clients, i->client);
silc_free(i);
(void *)i, 300, 0,
SILC_TASK_TIMEOUT, SILC_TASK_PRI_LOW);
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
+ client->data.status &= ~SILC_IDLIST_STATUS_LOCAL;
client->mode = 0;
client->router = NULL;
client->connection = NULL;
if (user_data->id)
backup_router = silc_server_backup_get(server, user_data->id);
+ if (!server->backup_router && server->server_type == SILC_ROUTER &&
+ backup_router == server->id_entry &&
+ sock->type != SILC_SOCKET_TYPE_ROUTER)
+ backup_router = NULL;
+
/* If this was our primary router connection then we're lost to
the outside world. */
if (server->router == user_data) {
("%s switched to backup router %s "
"(we are primary router now)",
server->server_name, server->server_name));
- else
+ else if (server->router)
SILC_SERVER_SEND_OPERS(server, FALSE, TRUE,
SILC_NOTIFY_TYPE_NONE,
("%s switched to backup router %s",
if (!channel) {
SILC_LOG_ERROR(("Received key for non-existent channel %s",
silc_id_render(id, SILC_ID_CHANNEL)));
- assert(FALSE);
goto out;
}
}
break;
continue;
}
+ if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED) &&
+ !client->connection && !client->router && !SILC_IS_LOCAL(client)) {
+ if (!silc_idcache_list_next(list, &id_cache))
+ break;
+ continue;
+ }
idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
silc_free(client_id);
+ if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED)) {
+ SILC_LOG_ERROR(("Attempting to add unregistered client to channel ",
+ "%s", channel->channel_name));
+ continue;
+ }
+
if (!silc_server_client_on_channel(client, channel, &chl)) {
/* Client was not on the channel, add it. */
chl = silc_calloc(1, sizeof(*chl));
char *name;
int i = 0;
- if (!channels ||!channels_user_modes)
+ if (!channels || !channels_user_modes ||
+ !(client->data.status & SILC_IDLIST_STATUS_REGISTERED))
goto out;
ch = silc_channel_payload_parse_list(channels->data, channels->len);