namespace libt2n
{
+/**
+ * Constructor
+ * @param _c connection for this command. Ownership of the pointer is outside.
+ * @param _command_timeout_usec timeout until the command has to be completed
+ * @param _hello_timeout_usec timeout until hello has to be received
+ */
command_client::command_client(client_connection* _c, long long _command_timeout_usec, long long _hello_timeout_usec)
: c(_c)
+ , constructorException(NULL)
{
command_timeout_usec=_command_timeout_usec;
hello_timeout_usec=_hello_timeout_usec;
c->close();
// store a copy of the exception that you can find out details about the error later
- std::auto_ptr<t2n_exception> tmp(e.clone());
- constructorException=tmp;
+ constructorException = e.clone();
}
catch (...)
{
}
}
+/**
+ * Destructor
+ */
+command_client::~command_client()
+{
+ if (constructorException)
+ {
+ delete constructorException;
+ constructorException = NULL;
+ }
+}
+
/** @brief replace the connection currently in use with a new one
@param _c pointer to the new connection
(*ostr) << "sending command, decoded data: " << std::endl;
boost::archive::xml_oarchive xo(*ostr);
xo << BOOST_SERIALIZATION_NVP(cc);
- }
+ }
c->write(ofs.str());