Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
59b109f4
Commit
59b109f4
authored
Aug 19, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(MBTCPMaster): попытка убрать лишний вызов setKeepAliveParams()
parent
c16ac65e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
11 deletions
+25
-11
libuniset2.spec
conf/libuniset2.spec
+4
-1
UTCPStream.h
include/UTCPStream.h
+3
-2
ModbusClient.cc
src/Communications/Modbus/ModbusClient.cc
+1
-1
ModbusTCPMaster.cc
src/Communications/Modbus/ModbusTCPMaster.cc
+10
-5
UTCPStream.cc
src/Communications/TCP/UTCPStream.cc
+7
-2
No files found.
conf/libuniset2.spec
View file @
59b109f4
...
...
@@ -14,7 +14,7 @@
Name: libuniset2
Version: 2.4
Release: alt
6
Release: alt
7
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
...
...
@@ -484,6 +484,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Fri Aug 19 2016 Pavel Vainerman <pv@altlinux.ru> 2.4-alt7
- minor fixes
* Tue Aug 09 2016 Pavel Vainerman <pv@altlinux.ru> 2.4-alt6
- build new version (optimization, refactoring)
...
...
include/UTCPStream.h
View file @
59b109f4
...
...
@@ -38,7 +38,7 @@ class UTCPStream:
// return true if OK
bool
setKeepAliveParams
(
timeout_t
timeout_sec
=
5
,
int
conn_keepcnt
=
1
,
int
keepintvl
=
2
);
bool
isSetLinger
();
bool
isSetLinger
()
const
;
void
forceDisconnect
();
// disconnect() без ожидания (с отключением SO_LINGER)
/*!
...
...
@@ -58,7 +58,8 @@ class UTCPStream:
ssize_t
writeData
(
const
void
*
buf
,
size_t
len
,
timeout_t
t
=
0
);
ssize_t
readData
(
void
*
buf
,
size_t
len
,
char
separator
=
0
,
timeout_t
t
=
0
);
int
getSocket
();
int
getSocket
()
const
;
timeout_t
getTimeout
()
const
;
protected
:
...
...
src/Communications/Modbus/ModbusClient.cc
View file @
59b109f4
...
...
@@ -565,7 +565,7 @@ mbErrCode ModbusClient::recv_pdu( ModbusByte qfunc, ModbusMessage& rbuf, timeout
// ДЛЯ ТОГО ЧТОБЫ НЕ ЖДАТЬ ПРОДОЛЖЕНИЯ БЕЗКОНЕЧНО СБРАСЫВАЕМ TIMEOUT
setChannelTimeout
(
10
);
// 10 msec
//
setChannelTimeout(10); // 10 msec
// Получаем остальную часть сообщения
size_t
rlen
=
getNextData
((
unsigned
char
*
)(
rbuf
.
data
),
rbuf
.
dlen
);
...
...
src/Communications/Modbus/ModbusTCPMaster.cc
View file @
59b109f4
...
...
@@ -56,11 +56,16 @@ size_t ModbusTCPMaster::getNextData( unsigned char* buf, size_t len )
// -------------------------------------------------------------------------
void
ModbusTCPMaster
::
setChannelTimeout
(
timeout_t
msec
)
{
if
(
tcp
)
{
tcp
->
setTimeout
(
msec
);
tcp
->
setKeepAliveParams
((
msec
>
1000
?
msec
/
1000
:
1
));
}
if
(
!
tcp
)
return
;
timeout_t
old
=
tcp
->
getTimeout
();
if
(
old
==
msec
)
return
;
tcp
->
setTimeout
(
msec
);
tcp
->
setKeepAliveParams
((
msec
>
1000
?
msec
/
1000
:
1
));
}
// -------------------------------------------------------------------------
mbErrCode
ModbusTCPMaster
::
sendData
(
unsigned
char
*
buf
,
size_t
len
)
...
...
src/Communications/TCP/UTCPStream.cc
View file @
59b109f4
...
...
@@ -42,7 +42,7 @@ bool UTCPStream::setKeepAliveParams(timeout_t timeout_sec, int keepcnt, int keep
return
UTCPCore
::
setKeepAliveParams
(
so
,
timeout_sec
,
keepcnt
,
keepintvl
);
}
// -------------------------------------------------------------------------
bool
UTCPStream
::
isSetLinger
()
bool
UTCPStream
::
isSetLinger
()
const
{
return
Socket
::
flags
.
linger
;
}
...
...
@@ -70,11 +70,16 @@ ssize_t UTCPStream::readData(void* buf, size_t len, char separator, timeout_t t)
return
TCPStream
::
readData
(
buf
,
len
,
separator
,
t
);
}
// -------------------------------------------------------------------------
int
UTCPStream
::
getSocket
()
int
UTCPStream
::
getSocket
()
const
{
return
TCPStream
::
so
;
}
// -------------------------------------------------------------------------
timeout_t
UTCPStream
::
getTimeout
()
const
{
return
TCPStream
::
timeout
;
}
// -------------------------------------------------------------------------
void
UTCPStream
::
create
(
const
std
::
string
&
hname
,
int
port
,
bool
throwflag
,
timeout_t
t
)
{
family
=
ost
::
Socket
::
IPV4
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment