--- parser3/src/classes/amqp.C 2026/10/06 23:57:02 1.25 +++ parser3/src/classes/amqp.C 2026/10/09 21:10:38 1.28 @@ -15,23 +15,11 @@ #include "pa_vbool.h" #include "pa_os.h" -#ifdef WITH_AMQP - -#include -#include -#include - -#ifndef WITHOUT_AMQP_SSL -#include -#endif - -#endif - -volatile const char * IDENT_AMQP_C="$Id: amqp.C,v 1.25 2026/10/06 23:57:02 moko Exp $" IDENT_PA_VAMQP_H; +volatile const char * IDENT_AMQP_C="$Id: amqp.C,v 1.28 2026/10/09 21:10:38 moko Exp $" IDENT_PA_VAMQP_H; class MAmqp: public Methoded { public: // VStateless_class - Value* create_new_value(Pool&) { return new VAmqp(); } + Value* create_new_value(Pool& apool) { return new VAmqp(apool); } public: MAmqp(); }; @@ -98,7 +86,7 @@ static void amqp_connect(VAmqp& self, Re int heartbeat_sec = 30; int reconnect_interval_sec = 0; bool tls_specified = false; -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL const char* tls_ca = 0; const char* tls_cert = 0; const char* tls_key = 0; @@ -126,7 +114,7 @@ static void amqp_connect(VAmqp& self, Re } else if(key=="auto_reconnect"){ reconnect_interval_sec=r.process(*value).as_int(); } else if(key=="tls"){ -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL tls_specified = true; if(HashStringValue* tls_options=value->get_hash()){ for(HashStringValue::Iterator t(*tls_options); t; t.next()){ @@ -155,7 +143,7 @@ static void amqp_connect(VAmqp& self, Re amqp_connection_state_t conn = amqp_new_connection(); amqp_socket_t* socket = 0; -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL if(tls_specified) { socket = amqp_ssl_socket_new(conn); if(!socket) @@ -455,16 +443,7 @@ static void _publish(Request& r, MethodP } static void _release(Request& r, MethodParams&) { - VAmqp& self=GET_SELF(r, VAmqp); - if(self.fconnection){ - amqp_connection_state_t conn=self.fconnection; - amqp_channel_close(conn, self.fchannel, AMQP_REPLY_SUCCESS); - amqp_connection_close(conn, AMQP_REPLY_SUCCESS); - amqp_destroy_connection(conn); - self.fconnection=0; - self.fchannel=0; - self.fstate=VAmqp::CONNECTION_DEAD; - } + GET_SELF(r, VAmqp).release(); } // to allow both [] and () call syntax