Skip to content

Commit

Permalink
Merge pull request #33 from dee-see/sonarsearch-crash
Browse files Browse the repository at this point in the history
Handle SonarSearch panic
  • Loading branch information
junnlikestea authored Dec 8, 2020
2 parents 322b278 + e0ddc83 commit 1375bdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions crobat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ pub struct Crobat {
}

impl Crobat {
pub async fn new() -> Self {
pub async fn connect() -> Result<Self> {
trace!("building crobat client");
let addr = "https://crobat-rpc.omnisint.io";
let conn = Crobat::build_tls_client(addr).await.unwrap();

Self {
client: CrobatClient::new(conn),
match Crobat::build_tls_client(addr).await {
Ok(conn) => Ok(Self {
client: CrobatClient::new(conn),
}),
Err(e) => Err(e),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/sources/sonarsearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl SonarSearch {
impl DataSource for SonarSearch {
async fn run(&self, host: Arc<String>, mut tx: Sender<Vec<String>>) -> Result<()> {
let mut results = Vec::with_capacity(QUEUE_SIZE);
let mut client = Crobat::new().await;
let mut client = Crobat::connect().await?;
let mut subs = client.get_subs(host.clone()).await?;

while let Some(r) = subs.next().await {
Expand Down

0 comments on commit 1375bdc

Please sign in to comment.