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

Little changes

parent f362c8f7
No related branches found
Tags 1.0.0
No related merge requests found
......@@ -292,6 +292,13 @@ void Socket2::get_device_property()
/*----- PROTECTED REGION ID(Socket2::get_device_property_after) ENABLED START -----*/
// Check device property data members init
transform(iOMultiplexing.begin(), iOMultiplexing.end(), iOMultiplexing.begin(), ::tolower);
if (iOMultiplexing == "sleep") {
multiplexing = SLEEP;
} else {
multiplexing = SELECT;
}
transform(protocol.begin(), protocol.end(), protocol.begin(), ::tolower);
if (protocol == "udp") {
proto = UDP;
......@@ -299,13 +306,6 @@ void Socket2::get_device_property()
proto = TCP;
}
transform(iOMultiplexing.begin(), iOMultiplexing.end(), iOMultiplexing.begin(), ::tolower);
if (iOMultiplexing == "sleep") {
multiplexing = SLEEP;
} else {
multiplexing = SELECT;
}
if (port <= 0 || port > 65535)
init_error = "Invalid port";
......@@ -522,7 +522,6 @@ void Socket2::write(const Tango::DevVarCharArray *argin)
goto error;
/* Continue if multiplexing == SLEEP */
} else { /* bytes_written < 0 */
check_state(false);
goto error;
}
}
......@@ -541,6 +540,7 @@ void Socket2::write(const Tango::DevVarCharArray *argin)
return;
error:
check_state(false);
sleep(tout);
timeout:
Tango::Except::throw_exception(
......@@ -735,7 +735,7 @@ void Socket2::close()
if(input_len + output_len)
{
WARN_STREAM << " Bytes dropped: " << input_len << " input, "
WARN_STREAM << " Bytes dropped: " << input_len << " (" << data.size() << ") input, "
<< output_len << " output" << endl;
}
......@@ -779,12 +779,12 @@ void Socket2::_read(size_t bytes_to_read)
goto error;
/* Continue if multiplexing == SLEEP */
} else { /* bytes_readed < 0 */
check_state(true);
goto error;
}
}
return;
error:
check_state(false);
sleep(tout);
timeout:
Tango::Except::throw_exception(
......@@ -843,6 +843,7 @@ void Socket2::check_state(bool forcing)
set_state(Tango::INIT);
set_status("Reconnecting due: " + mesg);
DEBUG_STREAM << "Reconnecting due: " << mesg << endl;
close();
resolve();
......
......@@ -75,12 +75,8 @@ class Socket2 : public TANGO_BASE_CLASS
// Add your own data members
string init_error;
enum {TCP, UDP} proto;
int fd;
int conn_state;
sockaddr_in sa;
socklen_t sa_len;
enum event_type {READ, WRITE};
......@@ -91,6 +87,11 @@ class Socket2 : public TANGO_BASE_CLASS
enum {SLEEP, SELECT} multiplexing;
timeval timeout_timeval, tout;
enum {TCP, UDP} proto;
sockaddr_in sa;
socklen_t sa_len;
/*----- PROTECTED REGION END -----*/ // Socket2::Data Members
// Device property data members
......
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="Socket2" pogoRevision="9.7">
<description description="" title="" sourcePath="/home/alessio.bogani/Sources/git-trees/linkstabilizer/deps/socket2/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<description description="" title="" sourcePath="/home/alessio/Sources/git-trees/4uhv/deps/socket2/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at elettra.eu> - Alessio Igor Bogani &lt;alessio.bogani" author="Alessio Igor Bogani &lt;alessio.bogani" emailDomain="elettra.eu>" classFamily="Communication" siteSpecific="" platform="Unix Like" bus="Socket" manufacturer="none" reference=""/>
</description>
......
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