If you pass that container as a pointer or reference to the handler, then from 
that handler, on an error, you can call:

  stored_ptr_to_container_->stop();

But you say that this doesn't work? 

Another way you can quit the loop is to throw some exception from your handler 
and catch it outside the call: 

for (;;) {
  try {
    default_container(handler).run();  
  }
  catch (WhateverException& whatever) {
    // choose to handle and keep running, or leave the for (;;) loop
  }
  catch (many other exceptions& ...) {
  }
}

Given that you describe a natural end-of-life for the connection though, 
there's probably a more proper way. Maybe some return value from a handler? 
(haven't checked.)


________________________________________
From: dominate [[email protected]]
Sent: Saturday, January 07, 2017 12:37 PM
To: [email protected]
Subject: Re: [Qpid Proton 0.14] how can i reconnect after timeout?

Sorry maybe I did not explain clearly.

When we make default_container::run, handler is run another thread, right?
Then, when I receive on_transport_close event, what I expect is that the
thread of handler ends so that I could resume from next line to the
default_container::run.
So, to try what could make handler thread return, I have tried every thing,
stopping container etc.

i.e.

(I write as pseudo syntax)

default_container(handler).run();
// it NEVER comes to this line! run never returns!

How can I achieve that the handler returns when I detect error?
Thank you very much!



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-0-14-how-can-i-reconnect-after-timeout-tp7657154p7657513.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to