Ich entwickle gerade Anwendung mit gSoap-Bibliothek und hat einige Missverständnisse der richtigen Verwendung Bibliothek. Ich habe ein Proxy-Objekt (-j-Flag) generiert, das meine eigenen Klassen umschloss, wie Sie unten sehen können. Die Anwendung muss rund um die Uhr funktionieren und sich gleichzeitig mit vielen Kameras (~ 50 Kameras) verbinden, so dass ich nach jeder Anfrage alle temporären Daten löschen muss. Ist es normal, nach jeder Anfrage soap_destroy() und soap_end() aufzurufen? Weil es nach jeder Anfrage zu viel zu tun scheint. Gibt es eine andere Möglichkeit der richtigen Verwendung?Korrekte Speichersteuerung in gSoap
DeviceBindingProxy::destroy()
{
soap_destroy(this->soap);
soap_end(this->soap);
}
class OnvifDeviceService : public Domain::IDeviceService
{
public:
OnvifDeviceService()
: m_deviceProxy(new DeviceBindingProxy)
{
soap_register_plugin(m_deviceProxy->soap, soap_wsse);
}
int OnvifDeviceService::getDeviceInformation(const Access::Domain::Endpoint &endpoint, Domain::DeviceInformation *information)
{
_tds__GetDeviceInformation tds__GetDeviceInformation;
_tds__GetDeviceInformationResponse tds__GetDeviceInformationResponse;
setupUserPasswordToProxy(endpoint);
m_deviceProxy->soap_endpoint = endpoint.endpoint().c_str();
int result = m_deviceProxy->GetDeviceInformation(&tds__GetDeviceInformation, tds__GetDeviceInformationResponse);
m_deviceProxy->soap_endpoint = NULL;
if (result != SOAP_OK) {
Common::Infrastructure::printSoapError("Fail to get device information.", m_deviceProxy->soap);
m_deviceProxy->destroy();
return -1;
}
*information = Domain::DeviceInformation(tds__GetDeviceInformationResponse.Manufacturer,
tds__GetDeviceInformationResponse.Model,
tds__GetDeviceInformationResponse.FirmwareVersion);
m_deviceProxy->destroy();
return 0;
}
}