On Thu, Aug 11, 2011 at 5:58 PM, Zane Bitter <zbitter(a)redhat.com> wrote:
On 11/08/11 00:59, Andrew Beekhof wrote:
>
> You tested this right? This part worked fine?
> (*options)["reconnect"] = reconnect;
>
Yes, and yes. It works because we always set the "reconnect" option to false
by default as soon as we start options processing. So the options->insert()
call was actually adding a duplicate key to the map. Which STL, helpfully,
did not complain about. But when qpid went to look it up, it got the first
one (which is always false). And now you know why it took me half a day to
write a 3-line patch (sigh).
Very good to know!
Can you patch the other calls to operate in the same way too please?
> On Thu, Aug 11, 2011 at 1:03 AM, Zane
Bitter<zbitter(a)redhat.com> wrote:
>>
>> Previously the --reconnect option was always ignored, so if the
>> connection
>> to the broker was lost it would never be re-established.
>>
>> Signed-off-by: Zane Bitter<zbitter(a)redhat.com>
>> ---
>> src/lib/mh_agent.cpp | 7 +++----
>> 1 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
>> index 3353335..dfb4efe 100644
>> --- a/src/lib/mh_agent.cpp
>> +++ b/src/lib/mh_agent.cpp
>> @@ -158,10 +158,9 @@ connection_option(int code, const char *name, const
>> char *arg, void *userdata)
>> options->insert(std::pair<std::string,
>> qpid::types::Variant>("sasl-mechanism", "GSSAPI"));
>>
>> } else if(strcmp(name, "reconnect") == 0) {
>> - if(arg&& strcmp(arg, "no") == 0) {
>> - options->insert(std::pair<std::string,
>> qpid::types::Variant>("reconnect", false));
>> - }
>> -
>> + bool reconnect = !arg || (strcasecmp(arg, "no") !=
0&&
>> + strcasecmp(arg, "false") != 0);
>> + (*options)["reconnect"] = reconnect;
>> } else {
>> options->insert(std::pair<std::string,
>> qpid::types::Variant>(name, arg));
>> }
>>
>> _______________________________________________
>> Matahari mailing list
>> Matahari(a)lists.fedorahosted.org
>>
https://fedorahosted.org/mailman/listinfo/matahari
>>