diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 92d94c8..bc1e9ba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,11 +7,27 @@ on: - master jobs: - default: - runs-on: ubuntu-latest + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + nim: + - '2.0.x' + - 'stable' + - devel + os: + - ubuntu-latest + + name: '${{ matrix.nim }} (${{ matrix.os }})' steps: - uses: actions/checkout@v4 - - uses: iffy/install-nim@v5 + - name: Setup nim + uses: jiro4989/setup-nim-action@v2 + with: + use-nightlies: true + nim-version: ${{ matrix.nim }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + - run: nimble install -y - run: nimble test - run: nimble test --gc:arc diff --git a/zmq.nimble b/zmq.nimble index 604263c..f14291a 100644 --- a/zmq.nimble +++ b/zmq.nimble @@ -1,6 +1,6 @@ # Package -version = "1.5.2" +version = "1.5.3" author = "Andreas Rumpf" description = "ZeroMQ wrapper" license = "MIT" diff --git a/zmq/connections.nim b/zmq/connections.nim index 79c9349..b4fa50e 100644 --- a/zmq/connections.nim +++ b/zmq/connections.nim @@ -91,6 +91,7 @@ proc terminate*(ctx: ZContext) = get/set socket options Declare socket options first because it's used in =destroy hooks ]# + # Some option take cint, int64 or uint64 proc setsockopt_impl[T: SomeOrdinal](s: ZSocket, option: ZSockOptions, optval: T) = var val: T = optval @@ -106,17 +107,16 @@ proc setsockopt_impl(s: ZSocket, option: ZSockOptions, optval: string) = # some sockopt returns integer values proc getsockopt_impl[T: SomeOrdinal](s: ZSocket, option: ZSockOptions, optval: var T) = var optval_len: int = sizeof(optval) - if bindings.getsockopt(s, option, addr(optval), addr(optval_len)) != 0: zmqError() # Some sockopt returns a string proc getsockopt_impl(s: ZSocket, option: ZSockOptions, optval: var string) = var optval_len: int = optval.len - if bindings.getsockopt(s, option, cstring(optval), addr(optval_len)) != 0: zmqError() + #[ Public set/get sockopt function on ZSocket / ZConnection ]# @@ -125,7 +125,7 @@ proc setsockopt*[T: SomeOrdinal|string](s: ZSocket, option: ZSockOptions, optval ## ## Careful, the ``sizeof`` of ``optval`` depends on the ``ZSockOptions`` passed. ## Check http://api.zeromq.org/4-2:zmq-setsockopt - setsockopt_impl[T](s, option, optval) + setsockopt_impl(s, option, optval) proc setsockopt[T: SomeOrdinal|string](c: ZConnectionImpl, option: ZSockOptions, optval: T) = ## Internal @@ -323,7 +323,7 @@ proc close(c: var ZConnectionImpl, linger: int = 500) = c.context.terminate() proc close*(c: ZConnection, linger: int = 500) = - c[].close() + close(c[], linger) # Send / Receive # Send with ZSocket type