simplify references to server_name
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
71a3855af6
commit
3e0ff2dc84
13 changed files with 29 additions and 26 deletions
|
@ -61,11 +61,11 @@ impl crate::Service for Service {
|
|||
db,
|
||||
server: args.server.clone(),
|
||||
bad_event_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
||||
admin_alias: OwnedRoomAliasId::try_from(format!("#admins:{}", &config.server_name))
|
||||
admin_alias: OwnedRoomAliasId::try_from(format!("#admins:{}", &args.server.name))
|
||||
.expect("#admins:server_name is valid alias name"),
|
||||
server_user: UserId::parse_with_server_name(
|
||||
String::from("conduit"),
|
||||
&config.server_name,
|
||||
&args.server.name,
|
||||
)
|
||||
.expect("@conduit:server_name is valid"),
|
||||
turn_secret,
|
||||
|
@ -107,7 +107,7 @@ impl Service {
|
|||
pub fn current_count(&self) -> Result<u64> { Ok(self.db.current_count()) }
|
||||
|
||||
#[inline]
|
||||
pub fn server_name(&self) -> &ServerName { self.server.config.server_name.as_ref() }
|
||||
pub fn server_name(&self) -> &ServerName { self.server.name.as_ref() }
|
||||
|
||||
pub fn allow_registration(&self) -> bool { self.server.config.allow_registration }
|
||||
|
||||
|
@ -207,7 +207,7 @@ impl Service {
|
|||
|
||||
#[inline]
|
||||
pub fn server_is_ours(&self, server_name: &ServerName) -> bool {
|
||||
server_name == self.server.config.server_name
|
||||
server_name == self.server_name()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -218,8 +218,6 @@ async fn migrate(services: &Services) -> Result<()> {
|
|||
}
|
||||
|
||||
async fn db_lt_12(services: &Services) -> Result<()> {
|
||||
let config = &services.server.config;
|
||||
|
||||
for username in &services
|
||||
.users
|
||||
.list_local_users()
|
||||
|
@ -227,7 +225,8 @@ async fn db_lt_12(services: &Services) -> Result<()> {
|
|||
.collect::<Vec<_>>()
|
||||
.await
|
||||
{
|
||||
let user = match UserId::parse_with_server_name(username.as_str(), &config.server_name) {
|
||||
let user = match UserId::parse_with_server_name(username.as_str(), &services.server.name)
|
||||
{
|
||||
| Ok(u) => u,
|
||||
| Err(e) => {
|
||||
warn!("Invalid username {username}: {e}");
|
||||
|
@ -297,8 +296,6 @@ async fn db_lt_12(services: &Services) -> Result<()> {
|
|||
}
|
||||
|
||||
async fn db_lt_13(services: &Services) -> Result<()> {
|
||||
let config = &services.server.config;
|
||||
|
||||
for username in &services
|
||||
.users
|
||||
.list_local_users()
|
||||
|
@ -306,7 +303,8 @@ async fn db_lt_13(services: &Services) -> Result<()> {
|
|||
.collect::<Vec<_>>()
|
||||
.await
|
||||
{
|
||||
let user = match UserId::parse_with_server_name(username.as_str(), &config.server_name) {
|
||||
let user = match UserId::parse_with_server_name(username.as_str(), &services.server.name)
|
||||
{
|
||||
| Ok(u) => u,
|
||||
| Err(e) => {
|
||||
warn!("Invalid username {username}: {e}");
|
||||
|
|
|
@ -401,8 +401,7 @@ impl super::Service {
|
|||
}
|
||||
|
||||
fn validate_dest(&self, dest: &ServerName) -> Result<()> {
|
||||
let config = &self.services.server.config;
|
||||
if dest == config.server_name && !config.federation_loopback {
|
||||
if dest == self.services.server.name && !self.services.server.config.federation_loopback {
|
||||
return Err!("Won't send federation request to ourselves");
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ impl Service {
|
|||
let servers_contains_ours = || {
|
||||
servers
|
||||
.as_ref()
|
||||
.is_some_and(|servers| servers.contains(&self.services.server.config.server_name))
|
||||
.is_some_and(|servers| servers.contains(&self.services.server.name))
|
||||
};
|
||||
|
||||
if !server_is_ours && !servers_contains_ours() {
|
||||
|
|
|
@ -850,7 +850,7 @@ impl Service {
|
|||
let txn_id = &*general_purpose::URL_SAFE_NO_PAD.encode(txn_hash);
|
||||
|
||||
let request = send_transaction_message::v1::Request {
|
||||
origin: self.server.config.server_name.clone(),
|
||||
origin: self.server.name.clone(),
|
||||
pdus: pdu_jsons,
|
||||
edus: edu_jsons,
|
||||
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue