OpenSSL is wrapped, but you need to know about OpenSSL functions and network
I/O.
` cFunction(sq[0].unsafeAddr.pointer) `
Run
ah sorry, missed
proc registerEvents(wrapper: var SomeWrapper) =
wrapper.events.onload =
proc (name: string) =
echo "loaded " & name
wrapper.onload(name)
Run
why call onload recursively?
if using ref object,
type
Events = object
onload, onfail: proc (name: string)
type
SomeWrapper = ref object
events: Events
onload, onfail: proc (name: string)
proc registerEvents(wrapper: SomeWrapper) =
wrapper.events.onload
using addr.
>
> var someObj = SomeWrapper()
>
> registerEvents(addr someObj)
>
>
> Run
why not using ref object? performance?
read-only -> using let
proc f(size=1) =
let (widFrame, hiFrame) =
if size == 1: (320, 200) else: (3200, 2000)
echo (widFrame, hiFrame)
f()
Run
` for i in 0 ..< param.len: do() `
Run
` quit() `
Run
> Well if you protect and dispose the ref properly,
"dispose"
Does it mean that the tracking of the GC disappears when casting ref to ptr ?
Should I use boehm gc ?
type
Foo = object
head, tail: ptr Foo
var
f = cast[ptr Foo](Foo.new())
pf = cast[pt
Is there a correct way to handle ref object with atomic? Is it a bad way to
cast to ptr?
@adrianv
[this](https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions)
parseopt.
Please see this article
[version-0180-released](https://nim-lang.org/blog/2018/03/01/version-0180-released.html)
Have you tried this? [asyncpg](https://github.com/cheatfate/asyncpg)
To wait for some result of Spawn's task, you can confirm by using isReady()
function.
For example,
[ChatApp#L38](https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L38)
In addition, recv is executed during sleepAsync, but it is blocked immediately
by readLine (). It will not be a solution because we can not receive messages
during blocking.
Probably because stdin.readLine() is a blocking call, the event loop is blocked
and other tasks can not be executed.
wait well in a separate thread, or such a library will be useful
[asynctools/asyncpty](https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncpty.nim)
thx a lot @jangko !!
> when you free the memory, Nim internal allocator might reuse it at the next
> alloc call, if it thinks the previous block allocated could be reuse, hence
> the garbage.
learned a lot, thank you !!!
> isn't this scenario a common practice when using C language?(I real
HTTP1.1\13\10
next req,
GET / HTTP1.11\13\10
#↑↑↑
# GET /foo HTTP1.1\13\10
sometimes, adding garbage char such as unicode which a previous request does
not have.
This was confirmed with the debug code here:
[mofuw#L65](https://github.com/2vg/mofuw/blob
I using ptr char for wrapping char*... (yay, libuv wrap)
However, should I use cstring? Is it recommend?
The string remains even after buffer is released on libuv.
I call alloc () and then cast it to ptr char, is this wrong?
perhaps Araq is talking about SSL wrapping.
looking at devel, it seems that the wrapper of libuv has been delete.
[https://github.com/nim-lang/Nim/tree/devel/lib/wrappers](https://github.com/nim-lang/Nim/tree/devel/lib/wrappers)
r](https://github.com/h2o/picohttpparser)
i needed such a fast parser to make a fast web server.
the resulting parser is this [mofuparser](https://github.com/2vg/mofuparser)
since it is zero copy, even when parsing 100, 000 times, the request parsing
ends in about 0.05 seconds. (CPU: Intel core 2D
@Araq thx araq !
this code is garbage... so i removed it
but thx !
Hi Kevin Welcome Nim-land !!
you can see many [Issue](https://github.com/nim-lang/Nim/issues)
And... can make other wrapper not
[Here](https://nim-lang.org/docs/lib.html#wrappers)
see this code [mofuw](https://github.com/2vg/mofuw/blob/master/mofuw.nim)
i trying make own async method approach
but, sometimes it works and seldom goes well ...
i found using spawn method passed pointer is nil.
i checked in this part
[mofuw#L108](https://github.com/2vg/mofuw/blob/master
I have seen evt-tls now.
dont the code base to look so big, so I would like to write a wrapper or
implement it pure.
a pull request to tell me
if there is any problem.
[nimuv](https://github.com/2vg/nimuv)
this is toy project using my wrapper made by me.
However, it is faster than Rust's tokio-minihttp.
[mofuw_uv](https://github.com/2vg/mofuw/blob/master/mofuw_uv.nim)
If you can do an asynchronous app
> > "accept" in "nativesockets"?
you can use "accept".
this is example code.
check
[accept](https://nim-lang.org/docs/posix.html#accept,SocketHandle,ptr.SockAddr,ptr.Socklen)
if you support only linux, can use accept4.
(can make socket non-blocking at the same time as accept.)
v
thx dom96 !!
i saw this code
[httpbeast](https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L216)
i saw a proc named getIoHandler for the first time.
which module is this proc ?
hi, im developping high-performance libev's event-loop multi-thread web server.
this: [mofuw_ev](https://github.com/2vg/mofuw/blob/master/mofuw_ev.nim)
but, when exec
wrk -c 1000 http://localhost:8080
get nil error...
when the load becomes large, the server drops due
30 matches
Mail list logo