Commits

Brandon Rhodes committed ec8a136

Updated get.sh to pull from ØMQ 2.0.10, and re-ran it. Also, tweaked
the script so it saves a platform.hpp for me to compare against those
I have cached from the earlier version.

Comments (0)

Files changed (11)

 cd $(dirname "$0")
 mkdir -p tmp
 
+UTIL=util-linux-ng-2.18
+ZEROMQ=zeromq-2.0.10
+PYZMQ=pyzmq-2.0.8
+
 # Download source distributions, or make sure they are up to date.
 cd tmp
-wget -c "http://www.kernel.org/pub/linux/utils/util-linux-ng/v2.18/util-linux-ng-2.18.tar.gz"
-wget -c "http://www.zeromq.org/local--files/area:download/zeromq-2.0.9.tar.gz"
-wget -c "http://pypi.python.org/packages/source/p/pyzmq/pyzmq-2.0.8.tar.gz#md5=b21ab6bc336c211c504068ecc55bc5cf"
+wget -c "http://www.kernel.org/pub/linux/utils/util-linux-ng/v2.18/$UTIL.tar.gz"
+wget -c "http://www.zeromq.org/local--files/area:download/$ZEROMQ.tar.gz"
+wget -c "http://pypi.python.org/packages/source/p/pyzmq/$PYZMQ.tar.gz#md5=b21ab6bc336c211c504068ecc55bc5cf"
 cd ..
 
 # Untar them.
-tar xvfz tmp/util-linux-ng-2.18.tar.gz
-tar xvfz tmp/zeromq-2.0.9.tar.gz
-tar xvfz tmp/pyzmq-2.0.8.tar.gz
-
-UTIL=util-linux-ng-2.18
-ZEROMQ=zeromq-2.0.9
-PYZMQ=pyzmq-2.0.8
+tar xvfz tmp/$UTIL.tar.gz
+tar xvfz tmp/$ZEROMQ.tar.gz
+tar xvfz tmp/$PYZMQ.tar.gz
 
 # Copy the files we need into our version-controlled directories.  (We
 # keep include_linux and include_darwin from one run to the next, since
 
 cp -r $PYZMQ/zmq/*.py $PYZMQ/zmq/eventloop $PYZMQ/zmq/tests zmq
 
-# # Generate platform.hpp from platform.hpp.in
-# (cd $ZEROMQ; ./configure)
-# case $(uname) in
-#     Linux)
-#         mkdir -p include_linux
-#         cp $ZEROMQ/src/platform.hpp include_linux
-#     ;;
-# esac
+# Generate platform.hpp from platform.hpp.in so that I can compare it
+# against the cached versions.
 
-# # Or copy it for Windows
-# cp $ZEROMQ/builds/msvc/platform.hpp include_nt
+(cd $ZEROMQ; ./configure)
+cp $ZEROMQ/src/platform.hpp .
 
 # Remove the source trees.
 rm -rf $PYZMQ $UTIL $ZEROMQ

include/platform.hpp.in

 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* 0MQ major version */
-#undef PACKAGE_VERSION_MAJOR
-
-/* 0MQ minor version */
-#undef PACKAGE_VERSION_MINOR
-
-/* 0MQ patchlevel */
-#undef PACKAGE_VERSION_PATCH
-
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
 #undef ZMQ_HAVE_WINDOWS
 
 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
-   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    #define below would cause a syntax error. */
 #undef _UINT32_T
 
         enum { uuid_string_len = 36 };
 
         //  Returns a pointer to buffer containing the textual
-        //  representation of the UUID. The caller is reponsible to
+        //  representation of the UUID. The callee is reponsible to
         //  free the allocated memory.
         const char *to_string ();
 
         inline bool check_read ()
         {
             //  Was the value prefetched already? If so, return.
-            if (&queue.front () != r)
+            if (&queue.front () != r && r)
                  return true;
 
             //  There's no prefetched value, so let us prefetch more values.
 /*  0MQ versioning support.                                                   */
 /******************************************************************************/
 
+/*  Version macros for compile-time API version detection                     */
+#define ZMQ_VERSION_MAJOR 2
+#define ZMQ_VERSION_MINOR 0
+#define ZMQ_VERSION_PATCH 10
+
+#define ZMQ_MAKE_VERSION(major, minor, patch) \
+    ((major) * 10000 + (minor) * 100 + (patch))
+#define ZMQ_VERSION \
+    ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
+
+/*  Run-time API version detection                                            */
 ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
 
 /******************************************************************************/
 #error
 #endif
 
-            //  Check whether certain time have elapsed since last command
-            //  processing.
-            if (current_time - last_processing_time <= max_command_delay)
+            //  Check whether TSC haven't jumped backwards (in case of migration
+            //  between CPU cores) and whether certain time have elapsed since
+            //  last command processing. If it didn't do nothing.
+            if (current_time >= last_processing_time &&
+                  current_time - last_processing_time <= max_command_delay)
                 return !terminated;
             last_processing_time = current_time;
         }
         return 0;
 
     case ZMQ_SWAP:
-        if (optvallen_ != sizeof (int64_t)) {
+        if (optvallen_ != sizeof (int64_t) || *((int64_t*) optval_) < 0) {
             errno = EINVAL;
             return -1;
         }
         return 0;
 
     case ZMQ_RATE:
-        if (optvallen_ != sizeof (int64_t)) {
+        if (optvallen_ != sizeof (int64_t) || *((int64_t*) optval_) < 0) {
             errno = EINVAL;
             return -1;
         }
         return 0;
         
     case ZMQ_RECOVERY_IVL:
-        if (optvallen_ != sizeof (int64_t)) {
+        if (optvallen_ != sizeof (int64_t)  || *((int64_t*) optval_) < 0) {
             errno = EINVAL;
             return -1;
         }
 
 void zmq::req_t::xrevive (class reader_t *pipe_)
 {
-    //  TODO: Actually, misbehaving peer can cause this kind of thing.
-    //  Handle it decently, presumably kill the offending connection.
-    zmq_assert (pipe_ == reply_pipe);
-    reply_pipe_active = true;
+    if (pipe_ == reply_pipe)
+        reply_pipe_active = true;
 }
 
 void zmq::req_t::xrevive (class writer_t *pipe_)
 
 zmq::uuid_t::~uuid_t ()
 {
+    if (string_buf)
+        RpcStringFree (&string_buf);
 }
 
 const char *zmq::uuid_t::to_string ()
 
 int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_)
 {
-    //  Deallocate old content of the message.
-    zmq_msg_close (msg_);
-
+    //  If there is a prefetched message, return it.
     if (prefetched) {
         zmq_msg_move (msg_, &prefetched_msg);
         more_in = msg_->flags & ZMQ_MSG_MORE;
         return 0;
     }
 
+    //  Deallocate old content of the message.
+    zmq_msg_close (msg_);
+
     //  If we are in the middle of reading a message, just grab next part of it.
     if (more_in) {
         zmq_assert (inpipes [current_in].active);
 
 void zmq_version (int *major_, int *minor_, int *patch_)
 {
-    *major_ = PACKAGE_VERSION_MAJOR;
-    *minor_ = PACKAGE_VERSION_MINOR;
-    *patch_ = PACKAGE_VERSION_PATCH;
+    *major_ = ZMQ_VERSION_MAJOR;
+    *minor_ = ZMQ_VERSION_MINOR;
+    *patch_ = ZMQ_VERSION_PATCH;
 }
 
 const char *zmq_strerror (int errnum_)