Skip to content
Snippets Groups Projects
Commit 36fd91bb authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Close connection if Write() is executed with buffer != 0

parent 24bca4a1
No related branches found
No related tags found
No related merge requests found
...@@ -496,15 +496,23 @@ void Socket2::write(const Tango::DevVarCharArray *argin) ...@@ -496,15 +496,23 @@ void Socket2::write(const Tango::DevVarCharArray *argin)
{ {
DEBUG_STREAM << "Socket2::Write() - " << device_name << std::endl; DEBUG_STREAM << "Socket2::Write() - " << device_name << std::endl;
/*----- PROTECTED REGION ID(Socket2::write) ENABLED START -----*/ /*----- PROTECTED REGION ID(Socket2::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()) { if (! init_error.empty()) {
sleep(tout); sleep(tout);
Tango::Except::throw_exception( Tango::Except::throw_exception(
"", init_error.c_str(), __PRETTY_FUNCTION__); "", init_error.c_str(), __PRETTY_FUNCTION__);
} }
vector<unsigned char> argin_data; if (max(output_queue_length(), 0) != 0) {
argin_data << *argin; close();
size_t bytes_total = 0, bytes_to_write = argin_data.size(); resolve();
open();
reconnections += 1;
goto error;
}
while (bytes_total < bytes_to_write) { while (bytes_total < bytes_to_write) {
int s = select(WRITE); int s = select(WRITE);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment