mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-26 00:24:55 +01:00
Fixes unecessary mut
all over the place
This commit is contained in:
parent
c0618e949d
commit
bde889582b
@ -84,7 +84,7 @@ impl Auth {
|
|||||||
pub fn new(passdb: Arc<PassDB>, session: Arc<Session>) -> Self {
|
pub fn new(passdb: Arc<PassDB>, session: Arc<Session>) -> Self {
|
||||||
let mut ctx = SASL::new().unwrap();
|
let mut ctx = SASL::new().unwrap();
|
||||||
|
|
||||||
let mut appdata = Box::new(AppData { passdb });
|
let appdata = Box::new(AppData { passdb });
|
||||||
|
|
||||||
ctx.store(appdata);
|
ctx.store(appdata);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ impl machines::Server for Machines {
|
|||||||
.map(|(n, m)| (n.clone(), m.clone()))
|
.map(|(n, m)| (n.clone(), m.clone()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut res = results.get();
|
let res = results.get();
|
||||||
let mut machines = res.init_machines(v.len() as u32);
|
let mut machines = res.init_machines(v.len() as u32);
|
||||||
|
|
||||||
for (i, (name, machine)) in v.into_iter().enumerate() {
|
for (i, (name, machine)) in v.into_iter().enumerate() {
|
||||||
|
@ -56,7 +56,7 @@ impl ConnectionHandler {
|
|||||||
Self { log, db, network }
|
Self { log, db, network }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle(&mut self, mut stream: TcpStream) -> impl Future<Output=Result<()>> {
|
pub fn handle(&mut self, stream: TcpStream) -> impl Future<Output=Result<()>> {
|
||||||
info!(self.log, "New connection from on {:?}", stream);
|
info!(self.log, "New connection from on {:?}", stream);
|
||||||
let session = Arc::new(Session::new(self.log.new(o!()), self.db.access.clone()));
|
let session = Arc::new(Session::new(self.log.new(o!()), self.db.access.clone()));
|
||||||
let boots = Bootstrap::new(session, self.db.clone(), self.network.clone());
|
let boots = Bootstrap::new(session, self.db.clone(), self.network.clone());
|
||||||
|
@ -50,7 +50,7 @@ impl Databases {
|
|||||||
let mdb = machine::init(log.new(o!("system" => "machines")), &config, env.clone())?;
|
let mdb = machine::init(log.new(o!("system" => "machines")), &config, env.clone())?;
|
||||||
|
|
||||||
let permdb = access::init(log.new(o!("system" => "permissions")), &config, env.clone())?;
|
let permdb = access::init(log.new(o!("system" => "permissions")), &config, env.clone())?;
|
||||||
let mut ac = access::AccessControl::new(permdb);
|
let ac = access::AccessControl::new(permdb);
|
||||||
|
|
||||||
let passdb = pass::PassDB::init(log.new(o!("system" => "passwords")), env.clone()).unwrap();
|
let passdb = pass::PassDB::init(log.new(o!("system" => "passwords")), env.clone()).unwrap();
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ impl Internal {
|
|||||||
{
|
{
|
||||||
match txn.get(self.db, &id.as_bytes()) {
|
match txn.get(self.db, &id.as_bytes()) {
|
||||||
Ok(bytes) => {
|
Ok(bytes) => {
|
||||||
let mut machine: MachineState = flexbuffers::from_slice(bytes)?;
|
let machine: MachineState = flexbuffers::from_slice(bytes)?;
|
||||||
Ok(Some(machine))
|
Ok(Some(machine))
|
||||||
},
|
},
|
||||||
Err(lmdb::Error::NotFound) => { Ok(None) },
|
Err(lmdb::Error::NotFound) => { Ok(None) },
|
||||||
|
@ -203,7 +203,7 @@ impl Future for Inner {
|
|||||||
type Output = MachineState;
|
type Output = MachineState;
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
|
||||||
let mut this = &mut *self;
|
let this = &mut *self;
|
||||||
// TODO Return this on exit
|
// TODO Return this on exit
|
||||||
if false {
|
if false {
|
||||||
return Poll::Ready(self.state.get_cloned());
|
return Poll::Ready(self.state.get_cloned());
|
||||||
|
@ -153,8 +153,8 @@ fn maybe(matches: clap::ArgMatches, log: Arc<Logger>) -> Result<(), Error> {
|
|||||||
smol::block_on(tok)?;
|
smol::block_on(tok)?;
|
||||||
|
|
||||||
let machines = machine::load(&config, db.access.clone())?;
|
let machines = machine::load(&config, db.access.clone())?;
|
||||||
let (mut actor_map, actors) = actor::load(&log, &mqtt, &config)?;
|
let (actor_map, actors) = actor::load(&log, &mqtt, &config)?;
|
||||||
let (mut init_map, initiators) = initiator::load(&log, &mqtt, &config)?;
|
let (init_map, initiators) = initiator::load(&log, &mqtt, &config)?;
|
||||||
|
|
||||||
// TODO: restore connections between initiators, machines, actors
|
// TODO: restore connections between initiators, machines, actors
|
||||||
let mut network = network::Network::new(machines, actor_map, init_map);
|
let mut network = network::Network::new(machines, actor_map, init_map);
|
||||||
|
Loading…
Reference in New Issue
Block a user