style
This commit is contained in:
parent
23733caed8
commit
42c318a1b8
1 changed files with 14 additions and 13 deletions
17
src/main.rs
17
src/main.rs
|
@ -112,21 +112,22 @@ async fn handle_peer(
|
|||
let ip = peer.ip();
|
||||
|
||||
let mut lines = FramedRead::new(stream, LinesCodec::new());
|
||||
loop {
|
||||
match lines.next().await.transpose()? {
|
||||
Some(line) => {
|
||||
let (prio, now, date, service, log) = parse_line(&line)?;
|
||||
while let Some(line) = lines.next().await.transpose()? {
|
||||
let ParsedLine {
|
||||
prio,
|
||||
rcvtime,
|
||||
logtime,
|
||||
service,
|
||||
entry,
|
||||
} = parse_line(&line)?;
|
||||
if !blacklist.contains(service) {
|
||||
db.execute(
|
||||
&insert_statement,
|
||||
&[&prio, &ip, &now, &date, &service, &log],
|
||||
&[&prio, &ip, &rcvtime, &logtime, &service, &entry],
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue