Commit ecffea60 authored by Pavel Vainerman's avatar Pavel Vainerman

Merge branch 'master' of git.eter:/projects/uniset

Conflicts: src/Communications/Modbus/ModbusTCPMaster.cc
parents b0a52ad2 c0fc88b2
......@@ -34,7 +34,7 @@
#include <UniSetTypes.h>
int seek=0;
int b_size=100000;
int b_size=25000;
int bj_size=1300000;
void testTable1(void)
{
......@@ -80,6 +80,9 @@ void testTable1(void)
bool testTable2(void)
{
char *val=new char[40];
TableBlockStorage t0;
t0.create("small_file.test", b_size, 4, 40, 100, 5,28,0);
t0.open("small_file.test", b_size, 4, 40, 100, 5,28,0);
TableBlockStorage t;
//t = new TableBlockStorage();
t.create("big_file.test", b_size, 4, 40, 100, 5,28,0);
......@@ -91,6 +94,7 @@ bool testTable2(void)
if(t.findKeyValue(&i,val)!=0) printf("%s, ",val);
}
printf("\n");
t0.addRow((char*)&i,val);
if(t.getCurBlock()!=0)
{
delete val;
......
......@@ -191,6 +191,9 @@ int main( int argc, char **argv )
mb.setTimeout(tout);
mb.connect(ia,port);
if( verb )
cout << "connection: " << (mb.isConnection() ? "YES" : "NO") << endl;
while( 1)
{
......
......@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter26
Release: eter29
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
......@@ -178,6 +178,12 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Oct 09 2009 Pavel Vainerman <pv@etersoft.ru> 0.97-eter28
- minor optimization
* Mon Oct 05 2009 Pavel Vainerman <pv@etersoft.ru> 0.97-eter27
- new build
* Sun Oct 04 2009 Vitaly Lipatov <lav@altlinux.ru> 0.97-eter26
- new build
......
......@@ -42,7 +42,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ):
string d_field = conf->getArgParam("--d-filter-field");
string d_fvalue = conf->getArgParam("--d-filter-value");
int lock_msec = conf->getArgInt("--lock-value-pause");
int lock_msec = conf->getArgPInt("--lock-value-pause",0);
if( lock_msec < 0 )
lock_msec = 0;
setCheckLockValuePause(lock_msec);
......
......@@ -48,17 +48,17 @@ int ModbusTCPMaster::nTransaction = 0;
mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
ModbusMessage& reply, timeout_t timeout )
{
// if( !isConnection() )
if( iaddr.empty() )
{
dlog[Debug::WARN] << "(query): not connection to server..." << endl;
dlog[Debug::WARN] << "(query): unknown ip address for server..." << endl;
return erHardwareError;
}
if( !isConnection() )
reconnect();
{
dlog[Debug::WARN] << "(query): not connected to server..." << endl;
return erTimeOut;
}
assert(timeout);
ptTimeout.setTiming(timeout);
......@@ -114,6 +114,15 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
if( tcp->isPending(ost::Socket::pendingInput,timeout) )
{
/*
unsigned char rbuf[100];
memset(rbuf,0,sizeof(rbuf));
int ret = getNextData(rbuf,sizeof(rbuf));
cerr << "ret=" << ret << " recv: ";
for( int i=0; i<sizeof(rbuf); i++ )
cerr << hex << " 0x" << (int)rbuf[i];
cerr << endl;
*/
ModbusTCP::MBAPHeader rmh;
int ret = getNextData((unsigned char*)(&rmh),sizeof(rmh));
if( dlog.debugging(Debug::INFO) )
......@@ -173,6 +182,8 @@ void ModbusTCPMaster::reconnect()
delete tcp;
}
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPMaster): reconnect " << iaddr << endl;
tcp = new ost::TCPStream(iaddr.c_str());
}
// -------------------------------------------------------------------------
......
......@@ -189,6 +189,8 @@ bool TableBlockStorage::open(const char* name, int byte_sz, int key_sz, int inf_
if(t->count >= 0)
break;
}
if( t->count < 0 )
cur_block = 0;
/*! */
fseek(file,seekpos+(cur_block*block_size)*(full_size),0);
......
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