Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 69318d0

Browse files
committed
Split the 'make-socket' function to allow pooled connections
* Move endpoint creation to its own function * Test with most recent version of PicoLisp * Update CHANGELOG.md
1 parent 9cb0a2a commit 69318d0

File tree

4 files changed

+27
-17
lines changed

4 files changed

+27
-17
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ before_install:
66

77
before_script:
88
- ./build.sh
9-
- wget http://software-lab.de/picoLisp-3.1.9.tgz -O /tmp/picolisp.tgz
9+
- wget http://software-lab.de/picoLisp.tgz -O /tmp/picolisp.tgz
1010
- cd /tmp; tar -xf /tmp/picolisp.tgz
1111
- cd /tmp/picoLisp/src64 && make
1212

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.5.23 (2014-04-08)
4+
5+
* Split the 'make-socket' function to allow pooled connections
6+
* Ensure travis tests with the latest version of PicoLisp
7+
38
## 0.5.22 (2014-04-07)
49

510
* Update to picolisp-unit v0.6.0

module.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[de MODULE_INFO
22
("name" "nanomsg")
3-
("version" "0.5.22")
3+
("version" "0.5.23")
44
("summary" "Nanomsg ffi-binding for PicoLisp")
55
("source" "https://github.com/aw/picolisp-nanomsg.git")
66
("author" "Alexander Williams")

nanomsg.l

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
(local MODULE_INFO MSG_MAX_SIZE *Nanomsg *NN_Symbols)
1010
(local nn-socket nn-close nn-setsockopt nn-getsockopt nn-bind nn-connect nn-shutdown nn-send nn-recv)
1111
(local nn-errno nn-strerror nn-symbol nn-poll nn-device nn-poll-lt-1 fetch-symbols symbol-val)
12-
(local exit-with-error exit-with-error-maybe make-socket sub-unsub non-blocking-io)
12+
(local exit-with-error exit-with-error-maybe make-socket make-endpoint check-endpoint sub-unsub non-blocking-io)
1313

1414
(load (pack (car (file)) "module.l"))
1515

@@ -135,20 +135,25 @@
135135
(let Sock (nn-socket Domain Type)
136136
(if (= -1 Sock)
137137
(exit-with-error Sock)
138-
(let Endpoint
139-
(cond ((= Type "NN_REP") (nn-bind Sock Addr))
140-
((= Type "NN_REQ") (nn-connect Sock Addr))
141-
((= Type "NN_PUB") (nn-bind Sock Addr))
142-
((= Type "NN_SUB") (nn-connect Sock Addr))
143-
((= Type "NN_BUS") (if (= Flag "BIND") (nn-bind Sock Addr) (nn-connect Sock Addr)))
144-
((= Type "NN_PAIR") (if (= Flag "BIND") (nn-bind Sock Addr) (nn-connect Sock Addr)))
145-
((= Type "NN_PULL") (nn-bind Sock Addr))
146-
((= Type "NN_PUSH") (nn-connect Sock Addr))
147-
((= Type "NN_SURVEYOR") (nn-bind Sock Addr))
148-
((= Type "NN_RESPONDENT") (nn-connect Sock Addr)) )
149-
(cond ((not Endpoint) (exit-with-error Sock))
150-
((= -1 Endpoint) (exit-with-error Sock Endpoint))
151-
(T (cons Sock Endpoint)) ]
138+
(let Endpoint (make-endpoint Addr Type Flag Sock)
139+
(check-endpoint Sock Endpoint) ]
140+
141+
[de make-endpoint (Addr Type Flag Sock)
142+
(cond ((= Type "NN_REP") (nn-bind Sock Addr))
143+
((= Type "NN_REQ") (nn-connect Sock Addr))
144+
((= Type "NN_PUB") (nn-bind Sock Addr))
145+
((= Type "NN_SUB") (nn-connect Sock Addr))
146+
((= Type "NN_BUS") (if (= Flag "BIND") (nn-bind Sock Addr) (nn-connect Sock Addr)))
147+
((= Type "NN_PAIR") (if (= Flag "BIND") (nn-bind Sock Addr) (nn-connect Sock Addr)))
148+
((= Type "NN_PULL") (nn-bind Sock Addr))
149+
((= Type "NN_PUSH") (nn-connect Sock Addr))
150+
((= Type "NN_SURVEYOR") (nn-bind Sock Addr))
151+
((= Type "NN_RESPONDENT") (nn-connect Sock Addr)) ]
152+
153+
[de check-endpoint (Sock Endpoint)
154+
(cond ((not Endpoint) (exit-with-error Sock))
155+
((= -1 Endpoint) (exit-with-error Sock Endpoint))
156+
(T (cons Sock Endpoint)) ]
152157

153158
[de sub-unsub (Sock Topic Type)
154159
(let Result

0 commit comments

Comments
 (0)