Skip to content
Permalink
Browse files

Little refactor to checking laptop signing key.

  • Loading branch information...
jtownson committed May 16, 2019
1 parent 1fa1d12 commit d5c0e6226b814df8a33dcf338250c05a8d03341a
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/io/iohk/scalanet/peergroup/PeerGroup.scala
@@ -6,6 +6,9 @@ import monix.eval.Task
import monix.execution.Scheduler
import monix.reactive.Observable

import scala.concurrent.Await
import scala.concurrent.duration.Duration

trait Channel[A, M] {
def to: A
def sendMessage(message: M): Task[Unit]
@@ -25,16 +28,20 @@ object PeerGroup {

abstract class TerminalPeerGroup[A, M](implicit scheduler: Scheduler, codec: Codec[M]) extends PeerGroup[A, M]

def create[PG](pg: => PG, config: Any): Either[InitializationError, PG] =
def create[PG <: PeerGroup[_, _]](pg: => PG, config: Any)(
implicit scheduler: Scheduler
): Either[InitializationError, PG] =
try {
Await.result(pg.initialize().runToFuture, Duration.Inf)
Right(pg)
} catch {
case t: Throwable =>
Left(InitializationError(initializationErrorMsg(config), t))
}

def createOrThrow[PG](pg: => PG, config: Any): PG =
def createOrThrow[PG <: PeerGroup[_, _]](pg: => PG, config: Any)(implicit scheduler: Scheduler): PG =
try {
Await.result(pg.initialize().runToFuture, Duration.Inf)
pg
} catch {
case t: Throwable =>

0 comments on commit d5c0e62

Please sign in to comment.
You can’t perform that action at this time.