Skip to content

Commit

Permalink
Reload info strings on ircd restart
Browse files Browse the repository at this point in the history
instead of serializing the loaded strings in the server state
  • Loading branch information
progval authored and spb committed Apr 14, 2024
1 parent 801fd69 commit c238780
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 2 additions & 3 deletions sable_ircd/src/server/server_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub struct ClientServerState {
auth_state: AuthClientState,
client_caps: CapabilityRepository,
listener_state: SavedListenerCollection,
info_strings: config::ServerInfoStrings,
}

#[async_trait]
Expand Down Expand Up @@ -107,7 +106,6 @@ impl sable_server::ServerType for ClientServer {
.save()
.await
.map_err(ServerSaveError::IoError)?,
info_strings: self.info_strings,
})
}

Expand All @@ -116,6 +114,7 @@ impl sable_server::ServerType for ClientServer {
state: ClientServerState,
node: Arc<NetworkNode>,
history_receiver: UnboundedReceiver<NetworkHistoryUpdate>,
config: &Self::ProcessedConfig,
) -> std::io::Result<Self> {
let (auth_send, auth_recv) = unbounded_channel();
let (action_send, action_recv) = unbounded_channel();
Expand Down Expand Up @@ -148,7 +147,7 @@ impl sable_server::ServerType for ClientServer {
client_caps: state.client_caps,
history_receiver: Mutex::new(history_receiver),
listeners: Movable::new(listeners),
info_strings: state.info_strings,
info_strings: config.info_strings.clone(),
})
}

Expand Down
6 changes: 5 additions & 1 deletion sable_server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,14 @@ where
state: ServerState<ST>,
net_config: SyncConfig,
server_config: ServerConfig<ST>,
) -> std::io::Result<Self> {
) -> Result<Self, anyhow::Error> {
let (server_send, server_recv) = unbounded_channel();
let (history_send, history_recv) = unbounded_channel();
let (remote_send, remote_recv) = unbounded_channel();

let processed_server_config = ST::validate_config(&server_config.server)
.context("Could not load server configuration")?;

let log = Arc::new(ReplicatedEventLog::restore(
state.log_state,
server_send,
Expand All @@ -342,6 +345,7 @@ where
state.server_state,
Arc::clone(&node),
history_recv,
&processed_server_config,
)?);

Ok(Self {
Expand Down
1 change: 1 addition & 0 deletions sable_server/src/server_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub trait ServerType: Send + Sync + Sized + 'static {
state: Self::Saved,
node: Arc<NetworkNode>,
history_receiver: UnboundedReceiver<NetworkHistoryUpdate>,
config: &Self::ProcessedConfig,
) -> std::io::Result<Self>;

/// Handle a request originating from a remote server
Expand Down
1 change: 1 addition & 0 deletions sable_services/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ where
_state: Self::Saved,
_node: Arc<NetworkNode>,
_history_receiver: UnboundedReceiver<sable_network::rpc::NetworkHistoryUpdate>,
_config: &Self::ProcessedConfig,
) -> std::io::Result<Self> {
unimplemented!("services can't hot-upgrade");
}
Expand Down

0 comments on commit c238780

Please sign in to comment.