Re: Nim, Support for https?

2019-10-22 Thread 2vg
OpenSSL is wrapped, but you need to know about OpenSSL functions and network I/O.

Re: Modern way to pass a sequence to a c function as a void pointer and to cast it back as seq

2019-05-16 Thread 2vg
` cFunction(sq[0].unsafeAddr.pointer) ` Run

Re: Using var object in a proc that is the object's property

2018-12-21 Thread 2vg
ah sorry, missed

Re: Using var object in a proc that is the object's property

2018-12-21 Thread 2vg
proc registerEvents(wrapper: var SomeWrapper) = wrapper.events.onload = proc (name: string) = echo "loaded " & name wrapper.onload(name) Run why call onload recursively?

Re: Using var object in a proc that is the object's property

2018-12-20 Thread 2vg
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

Re: Using var object in a proc that is the object's property

2018-12-20 Thread 2vg
using addr. > > var someObj = SomeWrapper() > > registerEvents(addr someObj) > > > Run why not using ref object? performance?

Re: why var can not be declared this way?

2018-11-05 Thread 2vg
read-only -> using let proc f(size=1) = let (widFrame, hiFrame) = if size == 1: (320, 200) else: (3200, 2000) echo (widFrame, hiFrame) f() Run

Re: Got "Warning: < is deprecated [Deprecated]"

2018-11-04 Thread 2vg
` for i in 0 ..< param.len: do() ` Run

Re: Why is it needed to discard void return value from c function?

2018-07-28 Thread 2vg
` quit() ` Run

Re: atomic and ref pointer

2018-04-04 Thread 2vg
> 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

atomic and ref pointer

2018-04-01 Thread 2vg
Is there a correct way to handle ref object with atomic? Is it a bad way to cast to ptr?

Re: Is there any way to create template with await?

2018-03-23 Thread 2vg
@adrianv [this](https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions)

Re: Warning: parseopt2 is deprecated

2018-03-16 Thread 2vg
parseopt. Please see this article [version-0180-released](https://nim-lang.org/blog/2018/03/01/version-0180-released.html)

Re: How to turn thread spawn call into an async call

2018-03-15 Thread 2vg
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)

Re: Need help with async client/server

2018-03-12 Thread 2vg
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.

Re: Need help with async client/server

2018-03-12 Thread 2vg
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)

Re: C's char* -> ptr char or cstring ?

2018-01-19 Thread 2vg
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

Re: C's char* -> ptr char or cstring ?

2018-01-19 Thread 2vg
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

C's char* -> ptr char or cstring ?

2018-01-19 Thread 2vg
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?

Re: Is anyone using the libuv wrappers?

2018-01-12 Thread 2vg
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)

Re: high load nil error on my web server

2018-01-10 Thread 2vg
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

Re: sometimes using spawn passed pointer is nil

2018-01-10 Thread 2vg
@Araq thx araq ! this code is garbage... so i removed it but thx !

Re: What can I do the help get to v1.0?

2018-01-10 Thread 2vg
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)

sometimes using spawn passed pointer is nil

2018-01-09 Thread 2vg
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

Re: Is anyone using the libuv wrappers?

2018-01-07 Thread 2vg
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.

Re: Is anyone using the libuv wrappers?

2018-01-07 Thread 2vg
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

Re: Sockets in Nim: I must choose between "select" and "accept"?

2018-01-04 Thread 2vg
> > "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

Re: where "getIoHandler()" ?

2018-01-04 Thread 2vg
thx dom96 !!

where "getIoHandler()" ?

2018-01-03 Thread 2vg
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 ?

high load nil error on my web server

2017-12-29 Thread 2vg
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