Hi all,

For the guide's paranoid pirate example, we need to set ZMQ_LINGER, but the
cl-zmq binding fails to handle socket options of type int. This patch fixes
the issue. (My previous patch added the correct constant for ZMQ_LINGER to
the cl-zmq binding.)

Peace,

-Luke
-- 
---------------------------------------------------
Dr Lucas Hope - lucas.r.hope@skype
Machine Learning and Software Engineering Consultant
Melbourne, Australia
From 4eccbcab88775af0a74a91244534b83664a258ee Mon Sep 17 00:00:00 2001
From: Luke Hope <[email protected]>
Date: Sat, 4 Jun 2011 09:51:33 +1000
Subject: [PATCH 2/2] Fix to setsockopt to allow changing the socket option's type from the default :int64.

Some socket options such as ZMQ_LINGER need :int instead. The solution is to add an optional int-type parameter which defaults to :int64. Thus the default behaviour of the function is preserved, but you can specify :int so options such as ZMQ_LINGER work.

Signed-off-by: Luke Hope <[email protected]>
---
 zeromq-api.lisp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/zeromq-api.lisp b/zeromq-api.lisp
index 1bb73a9..b629429 100644
--- a/zeromq-api.lisp
+++ b/zeromq-api.lisp
@@ -134,13 +134,13 @@ The string must be freed with FOREIGN-STRING-FREE."
 (defun msg-copy (dst src)
   (%msg-copy (msg-raw dst) (msg-raw src)))
 
-(defun setsockopt (socket option value)
+(defun setsockopt (socket option value &optional (int-type :int64))
   (etypecase value
     (string (with-foreign-string (string value)
               (%setsockopt socket option string (length value))))
-    (integer (with-foreign-object (int :int64)
-               (setf (mem-aref int :int64) value)
-               (%setsockopt socket option int (foreign-type-size :int64))))))
+    (integer (with-foreign-object (int int-type)
+               (setf (mem-aref int int-type) value)
+               (%setsockopt socket option int (foreign-type-size int-type))))))
 
 (defun getsockopt (socket option)
   (with-foreign-objects ((opt :int64)
-- 
1.7.4.1

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to