Skip to content

Commit

Permalink
fixe build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Aug 7, 2024
1 parent e5bf371 commit d9a3a34
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/lsp_ws.nim
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ proc logErrors(process: AsyncProcess): Future[void] {.async.} =

var socket: WebSocket = nil

proc callback(req: Request): Future[void] {.async.} =
proc callback(req: Request): Future[void] {.async, gcsafe.} =
log lvlInfo, fmt"Connection requested from {req}"
let process: AsyncProcess = ({.gcsafe.}: process)

Expand Down Expand Up @@ -139,14 +139,15 @@ proc callback(req: Request): Future[void] {.async.} =
logger.flush()
quit(0)

proc checkProcessStatus(): Future[void] {.async.} =
proc checkProcessStatus(): Future[void] {.async, gcsafe.} =
let process: AsyncProcess = ({.gcsafe.}: process)
while true:
await sleepAsync(1000)
if not process.isAlive:
log lvlError, "Process died"
quit(1)

process.onRestarted = proc() {.async.} =
process.onRestarted = proc() {.async, gcsafe.} =
asyncCheck checkProcessStatus()
var server = newAsyncHttpServer()
await server.serve(Port(port), callback)
Expand Down

0 comments on commit d9a3a34

Please sign in to comment.