remove upraises

This commit is contained in:
Diego 2024-08-14 18:15:27 +02:00
parent f0c6b05498
commit bdab3e9051
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806
15 changed files with 23 additions and 28 deletions

View File

@ -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"

View File

@ -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

View File

@ -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.} =

View File

@ -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.

View File

@ -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)

View File

@ -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) =

View File

@ -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) =

View File

@ -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()

View File

@ -4,7 +4,7 @@ import ./packets/length
import ./packets/read
import ./packets/write
push: {.upraises: [QuicError].}
{.push raises: [QuicError].}
export packet
export length

View File

@ -3,7 +3,7 @@ import ./varints
import ./packet
import ./packetnumber
push: {.upraises: [].}
{.push raises: [].}
proc len*(packet: Packet): int =
case packet.form

View File

@ -3,8 +3,6 @@ import ../connectionid
import ../version
import ./packetnumber
push: {.upraises: [].}
export connectionid
export PacketNumber

View File

@ -5,7 +5,7 @@ import ./varints
import ./packet
import ./reader
push: {.upraises: [QuicError].}
{.push raises: [QuicError].}
export reader

View File

@ -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) =

View File

@ -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

View File

@ -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) =