Hello community,

here is the log from the commit of package libArcus for openSUSE:Factory 
checked in at 2018-11-19 23:30:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libArcus (Old)
 and      /work/SRC/openSUSE:Factory/.libArcus.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libArcus"

Mon Nov 19 23:30:53 2018 rev:4 rq:649582 version:3.6.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libArcus/libArcus.changes        2018-10-25 
08:12:42.500173633 +0200
+++ /work/SRC/openSUSE:Factory/.libArcus.new/libArcus.changes   2018-11-19 
23:30:59.431259994 +0100
@@ -1,0 +2,6 @@
+Fri Nov 16 13:35:11 UTC 2018 - Adrian Schröter <adr...@suse.de>
+
+- version update to 3.6.0
+  * version change only
+
+-------------------------------------------------------------------

Old:
----
  libArcus-3.5.1.obscpio

New:
----
  libArcus-3.6.0.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libArcus.spec ++++++
--- /var/tmp/diff_new_pack.dFGh39/_old  2018-11-19 23:30:59.867259491 +0100
+++ /var/tmp/diff_new_pack.dFGh39/_new  2018-11-19 23:30:59.871259486 +0100
@@ -18,7 +18,7 @@
 
 %define sover 3
 Name:           libArcus
-Version:        3.5.1
+Version:        3.6.0
 Release:        0
 Summary:        3D printer control software
 License:        LGPL-3.0-only

++++++ _service ++++++
--- /var/tmp/diff_new_pack.dFGh39/_old  2018-11-19 23:30:59.899259454 +0100
+++ /var/tmp/diff_new_pack.dFGh39/_new  2018-11-19 23:30:59.899259454 +0100
@@ -2,8 +2,8 @@
   <service name="obs_scm" mode="disabled">
     <param name="url">https://github.com/Ultimaker/libArcus</param>
     <param name="scm">git</param>
-    <param name="revision">3.5.1</param>
-    <param name="version">3.5.1</param>
+    <param name="revision">3.6.0</param>
+    <param name="version">3.6.0</param>
     <param name="submodules">disable</param>
   </service>
   <service mode="disabled" name="set_version" />

++++++ libArcus-3.5.1.obscpio -> libArcus-3.6.0.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libArcus-3.5.1/src/Socket.cpp 
new/libArcus-3.6.0/src/Socket.cpp
--- old/libArcus-3.5.1/src/Socket.cpp   2018-06-29 09:39:16.000000000 +0200
+++ new/libArcus-3.6.0/src/Socket.cpp   2018-10-25 15:41:00.000000000 +0200
@@ -38,8 +38,14 @@
         delete d->thread;
     }
 
-    for(auto listener : d->listeners)
+    for(SocketListener* listener : d->listeners)
     {
+        /* If deleting the socket listener while another thread is reporting an
+         * error due to closing the socket, deleting the listener causes 
another
+         * error to report and this causes an infinite loop. Making sure the
+         * listener is dysfunctional before deleting it prevents this. */
+        listener->_socket = nullptr;
+
         delete listener;
     }
 }
@@ -219,19 +225,34 @@
     d->sendQueue.push_back(message);
 }
 
-MessagePtr Socket::takeNextMessage()
+MessagePtr Socket::takeNextMessage(bool blocking)
 {
-    std::lock_guard<std::mutex> lock(d->receiveQueueMutex);
-    if(d->receiveQueue.size() > 0)
+    std::unique_lock<std::mutex> lk(d->receiveQueueMutexBlock);
+
+    // Take the next message in the receive queue if available.
     {
-        MessagePtr next = d->receiveQueue.front();
-        d->receiveQueue.pop_front();
-        return next;
+        std::lock_guard<std::mutex> lock(d->receiveQueueMutex);
+        if(d->receiveQueue.size() > 0)
+        {
+            MessagePtr next = d->receiveQueue.front();
+            d->receiveQueue.pop_front();
+            return next;
+        }
     }
-    else
+
+    // If receive queue if empty and this is a non-blocking call, return 
nullptr immediately.
+    if (!blocking)
     {
         return nullptr;
     }
+
+    // For a blocking call, wait until the receive queue available signal gets 
triggered and fetch the first message
+    // in the receive queue.
+    // Note that wait causes the current thread to block until the condition 
variable is notified or a spurious wakeup
+    // occurs, optionally looping until some predicate is satisfied. See 
https://en.cppreference.com/w/cpp/thread/condition_variable/wait
+    d->message_received_condition_variable.wait(lk);
+    lk.unlock();
+    return takeNextMessage(blocking);
 }
 
 MessagePtr Arcus::Socket::createMessage(const std::string& type)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libArcus-3.5.1/src/Socket.h 
new/libArcus-3.6.0/src/Socket.h
--- old/libArcus-3.5.1/src/Socket.h     2018-06-29 09:39:16.000000000 +0200
+++ new/libArcus-3.6.0/src/Socket.h     2018-10-25 15:41:00.000000000 +0200
@@ -48,7 +48,7 @@
          *
          * \return The current socket state.
          */
-        SocketState::SocketState getState() const;
+        virtual SocketState::SocketState getState() const;
 
         /**
          * Get the last error.
@@ -70,7 +70,7 @@
          * \param message_type An instance of the Message that will be used as 
factory object.
          *
          */
-        bool registerMessageType(const google::protobuf::Message* 
message_type);
+        virtual bool registerMessageType(const google::protobuf::Message* 
message_type);
 
         /**
          * Register all message types contained in a Protobuf protocol 
description file.
@@ -79,7 +79,7 @@
          *
          * \param file_name The absolute path to a Protobuf protocol file to 
load message types from.
          */
-        bool registerAllMessageTypes(const std::string& file_name);
+        virtual bool registerAllMessageTypes(const std::string& file_name);
 
         /**
          * Add a listener object that will be notified of socket events.
@@ -89,6 +89,7 @@
          * \param listener The listener to add.
          */
         void addListener(SocketListener* listener);
+
         /**
          * Remove a listener from the list of listeners.
          *
@@ -104,40 +105,44 @@
          * \param address The IP address to connect to.
          * \param port The port to connect to.
          */
-        void connect(const std::string& address, int port);
+        virtual void connect(const std::string& address, int port);
+
         /**
          * Listen for connections on an address and port.
          *
          * \param address The IP address to listen on.
          * \param port The port to listen on.
          */
-        void listen(const std::string& address, int port);
+        virtual void listen(const std::string& address, int port);
+
         /**
          * Close the connection and stop handling any messages.
          */
-        void close();
+        virtual void close();
 
         /**
          * Reset a socket for re-use. State must be Closed or Error
          */
-        void reset();
+        virtual void reset();
 
         /**
          * Send a message across the socket.
          */
-        void sendMessage(MessagePtr message);
+        virtual void sendMessage(MessagePtr message);
 
         /**
-         * Remove and return the next pending message from the queue.
+         * Remove and return the next pending message from the queue with 
condition blocking.
+         *
+         * \param blocking If true, this function call will block until there 
is an available message.
          */
-        MessagePtr takeNextMessage();
+        virtual MessagePtr takeNextMessage(bool blocking = false);
 
         /**
          * Create an instance of a Message class.
          *
          * \param type_name The type name of the Message type to create an 
instance of.
          */
-        MessagePtr createMessage(const std::string& type_name);
+        virtual MessagePtr createMessage(const std::string& type_name);
 
     private:
         // Copy and assignment is not supported.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libArcus-3.5.1/src/Socket_p.h 
new/libArcus-3.6.0/src/Socket_p.h
--- old/libArcus-3.5.1/src/Socket_p.h   2018-06-29 09:39:16.000000000 +0200
+++ new/libArcus-3.6.0/src/Socket_p.h   2018-10-25 15:41:00.000000000 +0200
@@ -23,6 +23,7 @@
 #include <unordered_map>
 #include <deque>
 #include <iostream>
+#include <condition_variable>
 
 #ifdef _WIN32
     #include <winsock2.h>
@@ -116,6 +117,9 @@
         std::deque<MessagePtr> receiveQueue;
         std::mutex receiveQueueMutex;
 
+        std::mutex receiveQueueMutexBlock;
+        std::condition_variable message_received_condition_variable;
+
         Arcus::Private::PlatformSocket platform_socket;
 
         Error last_error;
@@ -344,6 +348,8 @@
                 }
             }
         }
+
+        message_received_condition_variable.notify_all();
     }
 
     // Send a message to the connected socket.
@@ -559,6 +565,8 @@
         {
             listener->messageReceived();
         }
+
+        message_received_condition_variable.notify_all();
     }
 
     // Send a keepalive packet to check whether we are still connected.

++++++ libArcus.obsinfo ++++++
--- /var/tmp/diff_new_pack.dFGh39/_old  2018-11-19 23:31:00.043259288 +0100
+++ /var/tmp/diff_new_pack.dFGh39/_new  2018-11-19 23:31:00.043259288 +0100
@@ -1,5 +1,5 @@
 name: libArcus
-version: 3.5.1
-mtime: 1530257956
-commit: 4fe4a3f48ae8c2fa85732675ee586cce7bf21abe
+version: 3.6.0
+mtime: 1540474860
+commit: 41b8ed7ad40c99a543e39ad696c890b05655978e
 


Reply via email to