Commit 9b58e430 authored by Pavel Vainerman's avatar Pavel Vainerman

(ModbusSlave): добавил вывод в vmonit информации host:port setbug #9012

parent 0e75f4e2
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
Name: libuniset2 Name: libuniset2
Version: 2.2 Version: 2.2
Release: alt21 Release: alt22
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
...@@ -451,6 +451,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -451,6 +451,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# .. # ..
%changelog %changelog
* Tue Feb 09 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt22
- ModbusSlave(TCP): add show ip:port to vmonit setbug #9012
* Sat Feb 06 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt21 * Sat Feb 06 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt21
- RRDServer: fixed bug in write sequence to rrd base - RRDServer: fixed bug in write sequence to rrd base
......
...@@ -2391,13 +2391,30 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam ) ...@@ -2391,13 +2391,30 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
{ {
UniSetTypes::SimpleInfo_var i = UniSetObject::getInfo(userparam); UniSetTypes::SimpleInfo_var i = UniSetObject::getInfo(userparam);
auto sslot = dynamic_pointer_cast<ModbusTCPServerSlot>(mbslot);
ostringstream inf; ostringstream inf;
inf << i->info << endl; inf << i->info << endl;
if( sslot ) // т.е. если у нас tcp
{
ost::InetAddress iaddr = sslot->getInetAddress();
inf << "TCPModbusSlave: " << iaddr << endl;
}
inf << vmon.pretty_str() << endl; inf << vmon.pretty_str() << endl;
inf << "LogServer: " << logserv_host << ":" << logserv_port << endl; inf << "LogServer: " << logserv_host << ":" << logserv_port << endl;
inf << "iomap=" << iomap.size() << " myaddr: " << ModbusServer::vaddr2str(vaddr) << endl; inf << "iomap=" << iomap.size() << " myaddr: " << ModbusServer::vaddr2str(vaddr) << endl;
inf << "Statistic: askCount=" << askCount << " pingOK=" << pingOK << endl; inf << "Statistic: askCount=" << askCount << " pingOK=" << pingOK << endl;
if( sslot ) // т.е. если у нас tcp
{
ost::InetAddress iaddr = sslot->getInetAddress();
inf << "TCP: " << iaddr << ":" << sslot->getInetPort() << endl;
}
i->info = inf.str().c_str(); i->info = inf.str().c_str();
return i._retn(); return i._retn();
......
...@@ -78,6 +78,9 @@ class ModbusTCPServer: ...@@ -78,6 +78,9 @@ class ModbusTCPServer:
void getSessions( Sessions& lst ); void getSessions( Sessions& lst );
inline ost::InetAddress getInetAddress(){ return iaddr; }
inline ost::tpport_t getInetPort(){ return port; }
protected: protected:
virtual ModbusRTU::mbErrCode pre_send_request( ModbusRTU::ModbusMessage& request ) override; virtual ModbusRTU::mbErrCode pre_send_request( ModbusRTU::ModbusMessage& request ) override;
......
...@@ -8,8 +8,9 @@ using namespace std; ...@@ -8,8 +8,9 @@ using namespace std;
using namespace ModbusRTU; using namespace ModbusRTU;
using namespace UniSetTypes; using namespace UniSetTypes;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
ModbusTCPServer::ModbusTCPServer( ost::InetAddress& ia, int port ): ModbusTCPServer::ModbusTCPServer( ost::InetAddress& ia, int _port ):
TCPSocket(ia, port), TCPSocket(ia, _port),
port(_port),
iaddr(ia), iaddr(ia),
ignoreAddr(false), ignoreAddr(false),
maxSessions(10), maxSessions(10),
......
Markdown is supported
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