diff --git a/src/Serial2.cpp b/src/Serial2.cpp index 4327f2679779da751aed39fce39def1a85d79f18..97efc0fdb93ccb0e4eaec9e74f56e6a3885f4454 100644 --- a/src/Serial2.cpp +++ b/src/Serial2.cpp @@ -524,15 +524,23 @@ void Serial2::write(const Tango::DevVarCharArray *argin) { DEBUG_STREAM << "Serial2::Write() - " << device_name << std::endl; /*----- PROTECTED REGION ID(Serial2::write) ENABLED START -----*/ + vector<unsigned char> argin_data; + argin_data << *argin; + size_t bytes_total = 0, bytes_to_write = argin_data.size(); + if (! init_error.empty()) { sleep(tout); Tango::Except::throw_exception( "", init_error.c_str(), __PRETTY_FUNCTION__); } - vector<unsigned char> argin_data; - argin_data << *argin; - size_t bytes_total = 0, bytes_to_write = argin_data.size(); + if (max(output_queue_length(), 0) != 0) { + close(); + resolve(); + open(); + reconnections += 1; + goto error; + } while (bytes_total < bytes_to_write) { int s = select(WRITE);