jiridanek commented on a change in pull request #309:
URL: https://github.com/apache/qpid-proton/pull/309#discussion_r619689825



##########
File path: cpp/src/delivery_test.cpp
##########
@@ -0,0 +1,139 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <proton/connection.hpp>
+#include <proton/connection_options.hpp>
+#include <proton/container.hpp>
+#include <proton/delivery.h>
+#include <proton/delivery.hpp>
+#include <proton/link.hpp>
+#include <proton/listen_handler.hpp>
+#include <proton/listener.hpp>
+#include <proton/message.hpp>
+#include <proton/message_id.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/tracker.hpp>
+#include <proton/types.h>
+#include <proton/types.hpp>
+#include <proton/value.hpp>
+
+#include "proton/error_condition.hpp"
+#include "proton/internal/pn_unique_ptr.hpp"
+#include "proton/receiver_options.hpp"
+#include "proton/transport.hpp"
+#include "proton/work_queue.hpp"
+#include "test_bits.hpp"
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+
+namespace {
+std::mutex m;
+std::condition_variable cv;
+bool listener_ready = false;
+int listener_port;
+} // namespace
+
+class test_recv : public proton::messaging_handler {
+  private:
+    class listener_ready_handler : public proton::listen_handler {
+        void on_open(proton::listener &l) PN_CPP_OVERRIDE {
+            {
+                std::lock_guard<std::mutex> lk(m);
+                listener_port = l.port();
+                listener_ready = true;
+            }
+            cv.notify_one();
+        }
+    };
+
+    std::string url;
+    proton::listener listener;
+    listener_ready_handler listen_handler;
+
+  public:
+    test_recv(const std::string &s) : url(s) {}
+
+    void on_container_start(proton::container &c) PN_CPP_OVERRIDE {
+        listener = c.listen(url, listen_handler);
+    }
+
+    void on_message(proton::delivery &d, proton::message &msg) PN_CPP_OVERRIDE 
{
+        d.receiver().close();
+        d.connection().close();
+        listener.stop();

Review comment:
       Awesome. As a further improvement you could look into, there's probably 
something like these .env files, 
https://github.com/microsoft/vscode-python/issues/544. The idea is that you 
don't have to specify env variables in the launch config, which is quite 
clumsy, but instead you can keep them in a more readable format in a file. But 
I guess there was not too many environment variables necessary. Probably just 
that `LD_LIBRARY_PATH` I mentioned, right?
   
   If you want some more work now, and to practice debugging ;P you could have 
a look at https://issues.apache.org/jira/browse/PROTON-2104. (Unless Justin 
finds you something better, or it's already time to look into your main task.) 
If you recall your tests for the url class, there were some tests for IPv6, and 
they were passing. So, how it's possible that IPv6 connections don't work? I 
tried stepping through the code in a debugger some time ago, and I left a 
comment. You'd have to double-check if the observations are still valid. Use 
the step-into command to follow the program execution, and see where the url 
string breaks. Then, you can propose a solution, where to best apply a fix.
   
   ## Motivational cartoon, just for fun ;)
   
   
![image](https://user-images.githubusercontent.com/442720/115968329-aed65b00-a537-11eb-9997-65d291fece92.png)
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to