File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
zio2-zmq/src/main/scala/zio/zmq Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -93,18 +93,20 @@ class ZSocket private (
9393 }
9494 .refineToOrDie[ZMQException ]
9595
96- msg <-
97- if (msg != null ) ZIO .succeed(msg)
98- else
99- ZIO
100- .attemptBlockingCancelable {
101- val msg = socket.recv(0 , canceled)
102- if (msg != null ) msg
103- else throw new ZMQException (socket.errno())
104- }(ZIO .attempt(socket.cancel(canceled)).orDie)
105- .refineToOrDie[ZMQException ]
106- .retryWhile(_.getErrorCode() == ZmqError .EAGAIN )
107- } yield msg
96+ msg <- if (msg != null ) ZIO .succeed(msg)
97+ else {
98+ zio
99+ .ZIO
100+ .attemptBlockingCancelable {
101+ val msg = socket.recv(0 , canceled)
102+ if (msg != null ) Right (msg)
103+ else Left (new ZMQException (socket.errno()))
104+ }(ZIO .attempt(socket.cancel(canceled)).orDie)
105+ .absolve
106+ .refineToOrDie[ZMQException ]
107+ .retryWhile(_.getErrorCode() == ZmqError .EAGAIN )
108+ }
109+ } yield msg
108110
109111 def receiveMsg : ZIO [Any , ZMQException , Msg ] = receiveMsgWait(
110112 new AtomicBoolean (false )
You can’t perform that action at this time.
0 commit comments