qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rabih M <rabih.prom...@gmail.com>
Subject [proton C++ 0.16.0] idle_timeout on windows can't be less than 1s
Date Wed, 12 Apr 2017 17:09:06 GMT
Hello,

I noticed that windows does not take into consideration the configured
connection idle_timeout if it is less than 1 second. Linux does not have
this problem.

I wrote some code to reproduce at the end of the mail.

Is it a bug ?

Best regards,
Rabih


#include <proton/messaging_handler.hpp>
#include <proton/connection.hpp>
#include <proton/connection_options.hpp>
#include <proton/default_container.hpp>
#include <Windows.h>

class hello_world : public proton::messaging_handler {
public:
   void on_container_start(proton::container& c) {
       c.connect("localhost:777777",
proton::connection_options().idle_timeout(proton::duration(10))); //takes
~1000ms
       // or c.connect("host:777777",
proton::connection_options().idle_timeout(proton::duration(10))); //takes ~
2500ms
   }
};

int main() {
   LARGE_INTEGER frequency;
   LARGE_INTEGER t1, t2;
   QueryPerformanceFrequency(&frequency);
   QueryPerformanceCounter(&t1);

   try {
      hello_world hw;
      proton::default_container(hw).run();
      return 0;
   }
   catch (const std::exception& e) {
      std::cerr << e.what() << std::endl;
   }

   QueryPerformanceCounter(&t2);
   double elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 /
frequency.QuadPart;
   std::cout << "elapsed: " << elapsedTime << std::endl;

   return 1;
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message