Skip to content

Commit 4cc1ca3

Browse files
authored
Merge pull request #48 from nim-lang/Clonkk-patch-1
Update connections.nim
2 parents 6eb2f6e + df2010a commit 4cc1ca3

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

.github/workflows/tests.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,27 @@ on:
77
- master
88

99
jobs:
10-
default:
11-
runs-on: ubuntu-latest
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
nim:
15+
- '2.0.x'
16+
- 'stable'
17+
- devel
18+
os:
19+
- ubuntu-latest
20+
21+
name: '${{ matrix.nim }} (${{ matrix.os }})'
1222
steps:
1323
- uses: actions/checkout@v4
14-
- uses: iffy/install-nim@v5
24+
- name: Setup nim
25+
uses: jiro4989/setup-nim-action@v2
26+
with:
27+
use-nightlies: true
28+
nim-version: ${{ matrix.nim }}
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
1531
- run: nimble install -y
1632
- run: nimble test
1733
- run: nimble test --gc:arc

zmq.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Package
22

3-
version = "1.5.2"
3+
version = "1.5.3"
44
author = "Andreas Rumpf"
55
description = "ZeroMQ wrapper"
66
license = "MIT"

zmq/connections.nim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ proc terminate*(ctx: ZContext) =
9191
get/set socket options
9292
Declare socket options first because it's used in =destroy hooks
9393
]#
94+
9495
# Some option take cint, int64 or uint64
9596
proc setsockopt_impl[T: SomeOrdinal](s: ZSocket, option: ZSockOptions, optval: T) =
9697
var val: T = optval
@@ -106,17 +107,16 @@ proc setsockopt_impl(s: ZSocket, option: ZSockOptions, optval: string) =
106107
# some sockopt returns integer values
107108
proc getsockopt_impl[T: SomeOrdinal](s: ZSocket, option: ZSockOptions, optval: var T) =
108109
var optval_len: int = sizeof(optval)
109-
110110
if bindings.getsockopt(s, option, addr(optval), addr(optval_len)) != 0:
111111
zmqError()
112112
113113
# Some sockopt returns a string
114114
proc getsockopt_impl(s: ZSocket, option: ZSockOptions, optval: var string) =
115115
var optval_len: int = optval.len
116-
117116
if bindings.getsockopt(s, option, cstring(optval), addr(optval_len)) != 0:
118117
zmqError()
119118
119+
120120
#[
121121
Public set/get sockopt function on ZSocket / ZConnection
122122
]#
@@ -125,7 +125,7 @@ proc setsockopt*[T: SomeOrdinal|string](s: ZSocket, option: ZSockOptions, optval
125125
##
126126
## Careful, the ``sizeof`` of ``optval`` depends on the ``ZSockOptions`` passed.
127127
## Check http://api.zeromq.org/4-2:zmq-setsockopt
128-
setsockopt_impl[T](s, option, optval)
128+
setsockopt_impl(s, option, optval)
129129
130130
proc setsockopt[T: SomeOrdinal|string](c: ZConnectionImpl, option: ZSockOptions, optval: T) =
131131
## Internal
@@ -323,7 +323,7 @@ proc close(c: var ZConnectionImpl, linger: int = 500) =
323323
c.context.terminate()
324324
325325
proc close*(c: ZConnection, linger: int = 500) =
326-
c[].close()
326+
close(c[], linger)
327327
328328
# Send / Receive
329329
# Send with ZSocket type

0 commit comments

Comments
 (0)