make tests green again
This commit is contained in:
parent
5e3d42a929
commit
4f582da27f
19 changed files with 166 additions and 149 deletions
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
type
|
||||
TEventArgs* = object of TObject ## Base object for event arguments that are passed to callback functions.
|
||||
TEventHandler* = tuple[name: string, handlers: seq[proc(e:TEventArgs)]] ## An eventhandler for an event.
|
||||
TEventHandler* = tuple[name: string, handlers: seq[proc(e:TEventArgs) {.closure.}]] ## An eventhandler for an event.
|
||||
|
||||
type
|
||||
TEventEmitter* = object {.pure, final.} ## An object that fires events and holds event handlers for an object.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ type
|
|||
JRetrText, JRetr, JStore
|
||||
|
||||
TFTPJob = object
|
||||
prc: proc (ftp: var TFTPClient, async: bool): bool
|
||||
prc: proc (ftp: var TFTPClient, async: bool): bool {.nimcall.}
|
||||
case typ*: FTPJobType
|
||||
of JRetrText:
|
||||
lines: string
|
||||
|
|
@ -60,7 +60,7 @@ type
|
|||
PAsyncFTPClient* = ref TAsyncFTPClient ## Async alternative to TFTPClient.
|
||||
TAsyncFTPClient* = object of TFTPClient
|
||||
handleEvent*: proc (ftp: var TAsyncFTPClient, ev: TFTPEvent,
|
||||
userArg: PObject)
|
||||
userArg: PObject) {.nimcall.}
|
||||
dele: PDelegate
|
||||
userArg: PObject
|
||||
|
||||
|
|
@ -116,8 +116,8 @@ proc assertReply(received: TaintedString, expected: openarray[string]) =
|
|||
[expected.join("' or '"), received.string])
|
||||
|
||||
proc createJob(ftp: var TFTPClient,
|
||||
prc: proc (ftp: var TFTPClient, async: bool): bool,
|
||||
cmd: FTPJobType) =
|
||||
prc: proc (ftp: var TFTPClient, async: bool): bool {.nimcall.},
|
||||
cmd: FTPJobType) =
|
||||
if ftp.jobInProgress:
|
||||
raise newException(EFTP, "Unable to do two jobs at once.")
|
||||
ftp.jobInProgress = true
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ type
|
|||
PAsyncIRC* = ref TAsyncIRC
|
||||
TAsyncIRC* = object of TIRC
|
||||
userArg: PObject
|
||||
handleEvent: proc (irc: var TAsyncIRC, ev: TIRCEvent, userArg: PObject)
|
||||
handleEvent: proc (irc: var TAsyncIRC, ev: TIRCEvent,
|
||||
userArg: PObject) {.nimcall.}
|
||||
lineBuffer: TaintedString
|
||||
|
||||
TIRCMType* = enum
|
||||
|
|
@ -366,7 +367,7 @@ proc asyncIRC*(address: string, port: TPort = 6667.TPort,
|
|||
joinChans: seq[string] = @[],
|
||||
msgLimit: bool = true,
|
||||
ircEvent: proc (irc: var TAsyncIRC, ev: TIRCEvent,
|
||||
userArg: PObject),
|
||||
userArg: PObject) {.nimcall.},
|
||||
userArg: PObject = nil): PAsyncIRC =
|
||||
## Use this function if you want to use asyncio's dispatcher.
|
||||
##
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ type
|
|||
|
||||
TAsyncScgiState* = object of TScgiState
|
||||
handleRequest: proc (server: var TAsyncScgiState, client: TSocket,
|
||||
input: string, headers: PStringTable,userArg: PObject)
|
||||
input: string, headers: PStringTable,
|
||||
userArg: PObject) {.nimcall.}
|
||||
userArg: PObject
|
||||
PAsyncScgiState* = ref TAsyncScgiState
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ proc writeStatusOkTextContent*(c: TSocket, contentType = "text/html") =
|
|||
"Content-Type: $1\r\L\r\L" % contentType)
|
||||
|
||||
proc run*(handleRequest: proc (client: TSocket, input: string,
|
||||
headers: PStringTable): bool,
|
||||
headers: PStringTable): bool {.nimcall.},
|
||||
port = TPort(4000)) =
|
||||
## encapsulates the SCGI object and main loop.
|
||||
var s: TScgiState
|
||||
|
|
@ -142,7 +143,7 @@ proc run*(handleRequest: proc (client: TSocket, input: string,
|
|||
|
||||
proc open*(handleRequest: proc (server: var TAsyncScgiState, client: TSocket,
|
||||
input: string, headers: PStringTable,
|
||||
userArg: PObject),
|
||||
userArg: PObject) {.nimcall.},
|
||||
port = TPort(4000), address = "127.0.0.1",
|
||||
userArg: PObject = nil): PAsyncScgiState =
|
||||
## Alternative of ``open`` for asyncio compatible SCGI.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue