This commit is contained in:
Yannik 2022-10-27 12:01:01 +02:00
parent 23733caed8
commit 42c318a1b8

View file

@ -112,21 +112,22 @@ async fn handle_peer(
let ip = peer.ip(); let ip = peer.ip();
let mut lines = FramedRead::new(stream, LinesCodec::new()); let mut lines = FramedRead::new(stream, LinesCodec::new());
loop { while let Some(line) = lines.next().await.transpose()? {
match lines.next().await.transpose()? { let ParsedLine {
Some(line) => { prio,
let (prio, now, date, service, log) = parse_line(&line)?; rcvtime,
logtime,
service,
entry,
} = parse_line(&line)?;
if !blacklist.contains(service) { if !blacklist.contains(service) {
db.execute( db.execute(
&insert_statement, &insert_statement,
&[&prio, &ip, &now, &date, &service, &log], &[&prio, &ip, &rcvtime, &logtime, &service, &entry],
) )
.await?; .await?;
} }
} }
None => break,
}
}
Ok(()) Ok(())
} }