From bdab3e9051de92e646491cb7a32eec0e7ce982ea Mon Sep 17 00:00:00 2001 From: Diego Date: Wed, 14 Aug 2024 18:15:27 +0200 Subject: [PATCH] remove upraises --- quic.nimble | 1 - quic/basics.nim | 2 -- quic/connection.nim | 6 +++--- quic/helpers/asyncloop.nim | 4 ++-- quic/listener.nim | 2 +- quic/transport/ngtcp2/connection/drainingstate.nim | 8 ++++---- quic/transport/ngtcp2/connection/openstate.nim | 2 +- quic/transport/ngtcp2/native/connection.nim | 4 ++-- quic/transport/packets.nim | 2 +- quic/transport/packets/length.nim | 2 +- quic/transport/packets/packet.nim | 2 -- quic/transport/packets/read.nim | 2 +- quic/transport/quicconnection.nim | 8 ++++---- quic/transport/stream.nim | 2 +- quic/transport/timeout.nim | 4 ++-- 15 files changed, 23 insertions(+), 28 deletions(-) diff --git a/quic.nimble b/quic.nimble index b7974e9..c996861 100644 --- a/quic.nimble +++ b/quic.nimble @@ -9,6 +9,5 @@ requires "stew >= 0.1.0 & < 0.2.0" requires "chronos >= 3.0.0 & < 4.0.0" requires "nimcrypto >= 0.6.0 & < 0.7.0" requires "ngtcp2 >= 0.32.0 & < 0.34.0" -requires "upraises >= 0.1.0 & < 0.2.0" requires "unittest2 >= 0.2.2 & < 0.3.0" requires "chronicles >= 0.10.2" diff --git a/quic/basics.nim b/quic/basics.nim index 4ded8fb..64c04fc 100644 --- a/quic/basics.nim +++ b/quic/basics.nim @@ -1,5 +1,4 @@ import pkg/chronos -import pkg/upraises import pkg/stew/results import ./udp/datagram import ./errors @@ -8,4 +7,3 @@ export chronos export datagram export results export errors -export upraises diff --git a/quic/connection.nim b/quic/connection.nim index 6cc452e..c51d0e2 100644 --- a/quic/connection.nim +++ b/quic/connection.nim @@ -18,7 +18,7 @@ type remote: TransportAddress quic: QuicConnection loop: Future[void] - onClose: Opt[proc() {.gcsafe, upraises: [].}] + onClose: Opt[proc() {.gcsafe, raises: [].}] closed: AsyncEvent IncomingConnection = ref object of Connection OutgoingConnection = ref object of Connection @@ -32,7 +32,7 @@ proc `onNewId=`*(connection: Connection, callback: IdCallback) = proc `onRemoveId=`*(connection: Connection, callback: IdCallback) = connection.quic.onRemoveId = callback -proc `onClose=`*(connection: Connection, callback: proc() {.gcsafe, upraises: [].}) = +proc `onClose=`*(connection: Connection, callback: proc() {.gcsafe, raises: [].}) = connection.onClose = Opt.some(callback) proc drop*(connection: Connection) {.async.} = @@ -67,7 +67,7 @@ proc stopSending(connection: Connection) {.async.} = await connection.loop.cancelAndWait() trace "Stopped sending loop" -method closeUdp(connection: Connection) {.async, base, upraises: [].} = +method closeUdp(connection: Connection) {.async, base, raises: [].} = discard method closeUdp(connection: OutgoingConnection) {.async.} = diff --git a/quic/helpers/asyncloop.nim b/quic/helpers/asyncloop.nim index e342fdf..3b9c7fc 100644 --- a/quic/helpers/asyncloop.nim +++ b/quic/helpers/asyncloop.nim @@ -1,6 +1,6 @@ -import pkg/[chronos, upraises] +import pkg/chronos -proc asyncLoop*(repeat: proc: Future[void] {.gcsafe, upraises: [CatchableError].}): Future[void] {.async.} = +proc asyncLoop*(repeat: proc: Future[void] {.gcsafe, raises: [CatchableError].}): Future[void] {.async.} = ## Repeatedly calls the async proc `repeat` until cancelled. ## Any `Error`s that are raised in `repeat` are considered fatal and therefore ## re-raised as `Defect`s. diff --git a/quic/listener.nim b/quic/listener.nim index 3e547f7..d8c0690 100644 --- a/quic/listener.nim +++ b/quic/listener.nim @@ -32,7 +32,7 @@ proc addConnection(listener: Listener, connection: Connection, listener.connections[newId] = connection connection.onRemoveId = proc(oldId: ConnectionId) = listener.connections.del(oldId) - connection.onClose = proc {.upraises: [].} = + connection.onClose = proc {.raises: [].} = for id in connection.ids & firstId: listener.connections.del(id) listener.incoming.putNoWait(connection) diff --git a/quic/transport/ngtcp2/connection/drainingstate.nim b/quic/transport/ngtcp2/connection/drainingstate.nim index 078339c..bab15f6 100644 --- a/quic/transport/ngtcp2/connection/drainingstate.nim +++ b/quic/transport/ngtcp2/connection/drainingstate.nim @@ -26,15 +26,15 @@ proc newDrainingConnection*(ids: seq[ConnectionId], state.init(ids, duration) state -proc onTimeout(state: DrainingConnection) {.upraises: [].} = +proc onTimeout(state: DrainingConnection) {.raises: [].} = state.done.fire() -push: {.locks: "unknown", upraises: [QuicError].} +{.push locks: "unknown", raises: [QuicError].} method enter*(state: DrainingConnection, connection: QuicConnection) = procCall enter(ConnectionState(state), connection) state.connection = Opt.some(connection) - state.timeout = newTimeout(proc {.upraises: [].} = state.onTimeout()) + state.timeout = newTimeout(proc {.raises: [].} = state.onTimeout()) state.timeout.set(state.duration) method leave(state: DrainingConnection) = @@ -42,7 +42,7 @@ method leave(state: DrainingConnection) = state.timeout.stop() state.connection = Opt.none(QuicConnection) -method ids(state: DrainingConnection): seq[ConnectionId] {.upraises: [].} = +method ids(state: DrainingConnection): seq[ConnectionId] {.raises: [].} = state.ids method send(state: DrainingConnection) = diff --git a/quic/transport/ngtcp2/connection/openstate.nim b/quic/transport/ngtcp2/connection/openstate.nim index 2aa9aaf..3d42b88 100644 --- a/quic/transport/ngtcp2/connection/openstate.nim +++ b/quic/transport/ngtcp2/connection/openstate.nim @@ -66,7 +66,7 @@ method leave(state: OpenConnection) = state.quicConnection = Opt.none(QuicConnection) trace "Left OpenConnection state" -method ids(state: OpenConnection): seq[ConnectionId] {.upraises: [].} = +method ids(state: OpenConnection): seq[ConnectionId] {.raises: [].} = state.ngtcp2Connection.ids method send(state: OpenConnection) = diff --git a/quic/transport/ngtcp2/native/connection.nim b/quic/transport/ngtcp2/native/connection.nim index ce7d14e..bc582ac 100644 --- a/quic/transport/ngtcp2/native/connection.nim +++ b/quic/transport/ngtcp2/native/connection.nim @@ -18,7 +18,7 @@ type buffer*: array[4096, byte] flowing*: AsyncEvent timeout*: Timeout - onSend*: proc(datagram: Datagram) {.gcsafe, upraises:[].} + onSend*: proc(datagram: Datagram) {.gcsafe, raises:[].} onIncomingStream*: proc(stream: Stream) onHandshakeDone*: proc() onNewId*: Opt[proc(id: ConnectionId)] @@ -36,7 +36,7 @@ proc destroy*(connection: Ngtcp2Connection) = connection.onNewId = Opt.none(proc(id: ConnectionId)) connection.onRemoveId = Opt.none(proc(id: ConnectionId)) -proc handleTimeout(connection: Ngtcp2Connection) {.gcsafe, upraises:[].} +proc handleTimeout(connection: Ngtcp2Connection) {.gcsafe, raises:[].} proc newConnection*(path: Path): Ngtcp2Connection = let connection = Ngtcp2Connection() diff --git a/quic/transport/packets.nim b/quic/transport/packets.nim index eb49538..6b3cd46 100644 --- a/quic/transport/packets.nim +++ b/quic/transport/packets.nim @@ -4,7 +4,7 @@ import ./packets/length import ./packets/read import ./packets/write -push: {.upraises: [QuicError].} +{.push raises: [QuicError].} export packet export length diff --git a/quic/transport/packets/length.nim b/quic/transport/packets/length.nim index 681cab1..91f26a2 100644 --- a/quic/transport/packets/length.nim +++ b/quic/transport/packets/length.nim @@ -3,7 +3,7 @@ import ./varints import ./packet import ./packetnumber -push: {.upraises: [].} +{.push raises: [].} proc len*(packet: Packet): int = case packet.form diff --git a/quic/transport/packets/packet.nim b/quic/transport/packets/packet.nim index d6ee9f2..c814f73 100644 --- a/quic/transport/packets/packet.nim +++ b/quic/transport/packets/packet.nim @@ -3,8 +3,6 @@ import ../connectionid import ../version import ./packetnumber -push: {.upraises: [].} - export connectionid export PacketNumber diff --git a/quic/transport/packets/read.nim b/quic/transport/packets/read.nim index 1e34125..161a80d 100644 --- a/quic/transport/packets/read.nim +++ b/quic/transport/packets/read.nim @@ -5,7 +5,7 @@ import ./varints import ./packet import ./reader -push: {.upraises: [QuicError].} +{.push raises: [QuicError].} export reader diff --git a/quic/transport/quicconnection.nim b/quic/transport/quicconnection.nim index af89d42..151b0df 100644 --- a/quic/transport/quicconnection.nim +++ b/quic/transport/quicconnection.nim @@ -12,15 +12,15 @@ type outgoing*: AsyncQueue[Datagram] incoming*: AsyncQueue[Stream] handshake*: AsyncEvent - disconnect*: Opt[proc(): Future[void] {.gcsafe, upraises: [].}] + disconnect*: Opt[proc(): Future[void] {.gcsafe, raises: [].}] onNewId*: IdCallback onRemoveId*: IdCallback ConnectionState* = ref object of RootObj entered: bool - IdCallback* = proc(id: ConnectionId) {.gcsafe, upraises: [].} + IdCallback* = proc(id: ConnectionId) {.gcsafe, raises: [].} ConnectionError* = object of QuicError -push: {.base, locks: "unknown", upraises: [QuicError].} +{.push base, locks: "unknown", raises: [QuicError].} method enter*(state: ConnectionState, connection: QuicConnection) = doAssert not state.entered # states are not reentrant @@ -29,7 +29,7 @@ method enter*(state: ConnectionState, connection: QuicConnection) = method leave*(state: ConnectionState) = discard -method ids*(state: ConnectionState): seq[ConnectionId] {.upraises: [].} = +method ids*(state: ConnectionState): seq[ConnectionId] {.raises: [].} = doAssert false # override this method method send*(state: ConnectionState) = diff --git a/quic/transport/stream.nim b/quic/transport/stream.nim index 813e3be..07bc7e1 100644 --- a/quic/transport/stream.nim +++ b/quic/transport/stream.nim @@ -10,7 +10,7 @@ type entered: bool StreamError* = object of QuicError -push: {.locks:"unknown", upraises: [QuicError].} +{.push locks:"unknown", raises: [QuicError].} method enter*(state: StreamState, stream: Stream) {.base.} = doAssert not state.entered # states are not reentrant diff --git a/quic/transport/timeout.nim b/quic/transport/timeout.nim index 58f3ac3..07c9270 100644 --- a/quic/transport/timeout.nim +++ b/quic/transport/timeout.nim @@ -2,7 +2,7 @@ import ../basics type Timeout* = ref object timer: Opt[TimerCallback] - onExpiry: proc () {.gcsafe, upraises:[].} + onExpiry: proc () {.gcsafe, raises:[].} expired: AsyncEvent proc setTimer(timeout: Timeout, moment: Moment) = @@ -13,7 +13,7 @@ proc setTimer(timeout: Timeout, moment: Moment) = const skip = proc () = discard -proc newTimeout*(onExpiry: proc () {.gcsafe, upraises:[].} = skip): Timeout = +proc newTimeout*(onExpiry: proc () {.gcsafe, raises:[].} = skip): Timeout = Timeout(onExpiry: onExpiry, expired: newAsyncEvent()) proc stop*(timeout: Timeout) =