diff --git a/chaos/common/direct_io/impl/ZMQDirectIOClientConnection.cpp b/chaos/common/direct_io/impl/ZMQDirectIOClientConnection.cpp index 356ec1d2d5d94b559b2ee28f5f2573f61c14f670..8c1585610564f7a27d292aee7743f087a8f45e06 100644 --- a/chaos/common/direct_io/impl/ZMQDirectIOClientConnection.cpp +++ b/chaos/common/direct_io/impl/ZMQDirectIOClientConnection.cpp @@ -41,7 +41,8 @@ socket_service(NULL){ ZMQDirectIOClientConnection::~ZMQDirectIOClientConnection() {} void ZMQDirectIOClientConnection::init(void *init_data) throw(chaos::CException) { - if(ensureSocket() == false) throw CException(-1, "Error configuring socket", __PRETTY_FUNCTION__); + int err = 0; + if((err = ensureSocket())) throw CException(err, "Error configuring socket", __PRETTY_FUNCTION__); } void ZMQDirectIOClientConnection::deinit() throw(chaos::CException) { @@ -217,6 +218,8 @@ int ZMQDirectIOClientConnection::getNewSocketPair() { } } catch(chaos::CException& ex) { releaseSocketPair(); + err = ex.errorCode; + DECODE_CHAOS_EXCEPTION(ex); } return err; } diff --git a/chaos/cu_toolkit/driver_manager/driver/AbstractRemoteIODriver.h b/chaos/cu_toolkit/driver_manager/driver/AbstractRemoteIODriver.h index 88d8a1e47148341783c55bcf146b6145ce25cf08..32d5a351e16477383f5b8259bb2fda1bc9ea1e7c 100644 --- a/chaos/cu_toolkit/driver_manager/driver/AbstractRemoteIODriver.h +++ b/chaos/cu_toolkit/driver_manager/driver/AbstractRemoteIODriver.h @@ -154,6 +154,26 @@ namespace chaos { ~AbstractRemoteIODriver(){} + //!Send raw request to the remote driver + /*! + \param message_data is the raw data to be transmitted to the remote driver + \param received_data si the raw data received from the driver + */ + int sendOpcodeRequest(const std::string opcode, + chaos::common::data::CDWUniquePtr message_data, + chaos::common::data::CDWShrdPtr& message_response, + uint32_t timeout = 5000) { + int err = 0; + LStringWriteLock wl = current_connection_identifier.getWriteLockObject(); + if((err = _managePhases())) { + return err; + } + return _sendRawOpcodeRequest(opcode, + ChaosMoveOperator(message_data), + message_response, + timeout); + } + //!Send raw request to the remote driver /*! \param message_data is the raw data to be transmitted to the remote driver @@ -168,7 +188,8 @@ namespace chaos { return err; } return _sendRawRequest(ChaosMoveOperator(message_data), - message_response); + message_response, + timeout); } //!Send raw message to the remote driver @@ -326,12 +347,14 @@ namespace chaos { //send datapack as opcode format int _sendRawOpcodeRequest(const std::string opcode, chaos::common::data::CDWUniquePtr message_data, - chaos::common::data::CDWShrdPtr& message_response) { + chaos::common::data::CDWShrdPtr& message_response, + uint32_t timeout = 5000) { chaos::common::data::CDWUniquePtr opcpde_msg(new chaos::common::data::CDataWrapper()); opcpde_msg->addStringValue(MESSAGE_OPCODE, opcode); opcpde_msg->addCSDataValue(MESSAGE_OPCODE_PARAMETER, *message_data); return _sendRawRequest(ChaosMoveOperator(opcpde_msg), - message_response); + message_response, + timeout); } int _sendRawRequest(chaos::common::data::CDWUniquePtr message_data,