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
15b81657
Commit
15b81657
authored
Jan 18, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Попытка исправить ошибку компиляции под p7, make style
parent
04b387b3
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
121 additions
and
40 deletions
+121
-40
libuniset2.spec
conf/libuniset2.spec
+7
-0
configure.ac
configure.ac
+3
-1
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+1
-0
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+4
-4
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+3
-2
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+11
-6
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+4
-1
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+1
-0
CommonEventLoop.h
include/CommonEventLoop.h
+12
-6
EventLoopServer.h
include/EventLoopServer.h
+2
-2
LogServer.h
include/LogServer.h
+4
-1
UDPCore.h
include/UDPCore.h
+29
-14
USocket.h
include/USocket.h
+30
-0
ModbusTCPServer.h
include/modbus/ModbusTCPServer.h
+0
-2
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+2
-0
LogServer.cc
src/Log/LogServer.cc
+1
-0
CommonEventLoop.cc
src/Processes/CommonEventLoop.cc
+6
-1
EventLoopServer.cc
src/Processes/EventLoopServer.cc
+1
-0
No files found.
conf/libuniset2.spec
View file @
15b81657
...
@@ -532,6 +532,13 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -532,6 +532,13 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
* Mon Jan 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt19
* Mon Jan 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt19
- rebuild new version
- rebuild new version
* Mon Jan 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt17.2.3.alt1
- add supported libev:
- refactoring ModbusSlave (use libev)
- refactoring LogServer (use libev)
- refactoring UNetReceiver (use libev)
- minor fixes
* Fri Jan 15 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt17
* Fri Jan 15 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt17
- rebuild new version
- rebuild new version
...
...
configure.ac
View file @
15b81657
...
@@ -297,8 +297,10 @@ AC_SUBST(COV_CFLAGS)
...
@@ -297,8 +297,10 @@ AC_SUBST(COV_CFLAGS)
AM_CONDITIONAL(HAVE_COVERAGE, test ${buildgcov} = true)
AM_CONDITIONAL(HAVE_COVERAGE, test ${buildgcov} = true)
AM_CONDITIONAL(HAVE_TESTS, test ${buildtests} = true)
AM_CONDITIONAL(HAVE_TESTS, test ${buildtests} = true)
# -D_GLIBCXX_USE_NANOSLEEP - for std::this_thread::sleep_for
# -Weffc++ -Wno-unused-variable -Werror -Wctor-dtor-privacy
# -Weffc++ -Wno-unused-variable -Werror -Wctor-dtor-privacy
CXX_EXTRA_FLAGS="-Wnon-virtual-dtor -Woverloaded-virtual -Woverflow"
CXX_EXTRA_FLAGS="-Wnon-virtual-dtor -Woverloaded-virtual -Woverflow
-D_GLIBCXX_USE_NANOSLEEP
"
# export
# export
LDFLAGS="$LDFLAGS ${OMNI_LIBS} ${XML_LIBS} ${SIGC_LIBS} ${COV_LIBS} ${COMCPP_LIBS}"
LDFLAGS="$LDFLAGS ${OMNI_LIBS} ${XML_LIBS} ${SIGC_LIBS} ${COV_LIBS} ${COMCPP_LIBS}"
...
...
extensions/SharedMemory/SharedMemory.cc
View file @
15b81657
...
@@ -331,6 +331,7 @@ CORBA::Boolean SharedMemory::exist()
...
@@ -331,6 +331,7 @@ CORBA::Boolean SharedMemory::exist()
void
SharedMemory
::
sigterm
(
int
signo
)
void
SharedMemory
::
sigterm
(
int
signo
)
{
{
workready
=
false
;
workready
=
false
;
if
(
signo
==
SIGTERM
&&
wdt
)
if
(
signo
==
SIGTERM
&&
wdt
)
wdt
->
stop
();
wdt
->
stop
();
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
15b81657
...
@@ -126,8 +126,8 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh
...
@@ -126,8 +126,8 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh
// Если указано поле unet_broadcast_ip непосредственно у узла - берём его
// Если указано поле unet_broadcast_ip непосредственно у узла - берём его
// если не указано берём общий broadcast_ip
// если не указано берём общий broadcast_ip
string
h
=
{
n_it
.
getProp2
(
"unet_broadcast_ip"
,
default_ip
)
};
string
h
=
{
n_it
.
getProp2
(
"unet_broadcast_ip"
,
default_ip
)
};
string
h2
=
{
n_it
.
getProp2
(
"unet_broadcast_ip2"
,
default_ip2
)
};
string
h2
=
{
n_it
.
getProp2
(
"unet_broadcast_ip2"
,
default_ip2
)
};
if
(
h
.
empty
()
)
if
(
h
.
empty
()
)
{
{
...
@@ -142,10 +142,10 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh
...
@@ -142,10 +142,10 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh
// Если указано поле unet_port - используем его
// Если указано поле unet_port - используем его
// Иначе port = идентификатору узла
// Иначе port = идентификатору узла
int
p
=
n_it
.
getPIntProp
(
"unet_port"
,
n_it
.
getIntProp
(
"id"
));
int
p
=
n_it
.
getPIntProp
(
"unet_port"
,
n_it
.
getIntProp
(
"id"
));
// по умолчанию порт на втором канале такой же как на первом (если не задан отдельно)
// по умолчанию порт на втором канале такой же как на первом (если не задан отдельно)
int
p2
=
n_it
.
getPIntProp
(
"unet_port2"
,
p
);
int
p2
=
n_it
.
getPIntProp
(
"unet_port2"
,
p
);
string
n
(
n_it
.
getProp
(
"name"
));
string
n
(
n_it
.
getProp
(
"name"
));
...
...
extensions/UNetUDP/UNetExchange.h
View file @
15b81657
...
@@ -53,7 +53,8 @@
...
@@ -53,7 +53,8 @@
Основная идея заключается в том, что каждый узел на порту равном своему ID
Основная идея заключается в том, что каждый узел на порту равном своему ID
посылает в сеть UDP-пакеты содержащие данные считанные из локальной SM. Формат данных - это набор
посылает в сеть UDP-пакеты содержащие данные считанные из локальной SM. Формат данных - это набор
пар [id,value]. Другие узлы принимают их. Помимо этого данный процесс запускает
пар [id,value]. Другие узлы принимают их. Помимо этого данный процесс запускает
по потоку приёма для каждого другого узла и ловит пакеты от них, сохраняя данные в SM.
"получателей" по одному на каждый (другой) узел и ловит пакеты от них, сохраняя данные в SM.
При этом "получатели" работют на одном(!) потоке с использованием событий libev (см. UNetReceiver).
\par
\par
При своём старте процесс считывает из секции \<nodes> список узлов которые необходимо "слушать",
При своём старте процесс считывает из секции \<nodes> список узлов которые необходимо "слушать",
...
@@ -173,7 +174,7 @@ class UNetExchange:
...
@@ -173,7 +174,7 @@ class UNetExchange:
tmStep
tmStep
};
};
private
:
private
:
UNetExchange
();
UNetExchange
();
timeout_t
initPause
;
timeout_t
initPause
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
15b81657
...
@@ -132,7 +132,8 @@ void UNetReceiver::setReceivePause( timeout_t msec )
...
@@ -132,7 +132,8 @@ void UNetReceiver::setReceivePause( timeout_t msec )
void
UNetReceiver
::
setUpdatePause
(
timeout_t
msec
)
void
UNetReceiver
::
setUpdatePause
(
timeout_t
msec
)
{
{
updatepause
=
msec
;
updatepause
=
msec
;
updateTime
=
(
double
)
updatepause
/
1000.0
;
updateTime
=
(
double
)
updatepause
/
1000.0
;
if
(
evUpdate
.
is_active
()
)
if
(
evUpdate
.
is_active
()
)
evUpdate
.
start
(
updateTime
);
evUpdate
.
start
(
updateTime
);
}
}
...
@@ -179,10 +180,11 @@ void UNetReceiver::resetTimeout()
...
@@ -179,10 +180,11 @@ void UNetReceiver::resetTimeout()
void
UNetReceiver
::
start
()
void
UNetReceiver
::
start
()
{
{
unetinfo
<<
myname
<<
":... start... "
<<
endl
;
unetinfo
<<
myname
<<
":... start... "
<<
endl
;
if
(
!
activated
)
if
(
!
activated
)
{
{
activated
=
true
;
activated
=
true
;
loop
.
evrun
(
this
,
true
);
loop
.
evrun
(
this
,
true
);
}
}
else
else
forceUpdate
();
forceUpdate
();
...
@@ -191,7 +193,7 @@ void UNetReceiver::start()
...
@@ -191,7 +193,7 @@ void UNetReceiver::start()
void
UNetReceiver
::
evprepare
(
const
ev
::
loop_ref
&
eloop
)
void
UNetReceiver
::
evprepare
(
const
ev
::
loop_ref
&
eloop
)
{
{
evReceive
.
set
(
eloop
);
evReceive
.
set
(
eloop
);
evReceive
.
start
(
udp
->
getSocket
(),
ev
::
READ
);
evReceive
.
start
(
udp
->
getSocket
(),
ev
::
READ
);
evUpdate
.
set
(
eloop
);
evUpdate
.
set
(
eloop
);
evUpdate
.
start
(
updateTime
);
evUpdate
.
start
(
updateTime
);
...
@@ -200,6 +202,7 @@ void UNetReceiver::evprepare( const ev::loop_ref& eloop )
...
@@ -200,6 +202,7 @@ void UNetReceiver::evprepare( const ev::loop_ref& eloop )
void
UNetReceiver
::
evfinish
(
const
ev
::
loop_ref
&
eloop
)
void
UNetReceiver
::
evfinish
(
const
ev
::
loop_ref
&
eloop
)
{
{
activated
=
false
;
activated
=
false
;
if
(
evReceive
.
is_active
()
)
if
(
evReceive
.
is_active
()
)
evReceive
.
stop
();
evReceive
.
stop
();
...
@@ -399,6 +402,7 @@ void UNetReceiver::readEvent( ev::io& watcher )
...
@@ -399,6 +402,7 @@ void UNetReceiver::readEvent( ev::io& watcher )
return
;
return
;
bool
tout
=
false
;
bool
tout
=
false
;
try
try
{
{
if
(
receive
()
)
if
(
receive
()
)
...
@@ -427,6 +431,7 @@ void UNetReceiver::readEvent( ev::io& watcher )
...
@@ -427,6 +431,7 @@ void UNetReceiver::readEvent( ev::io& watcher )
if
(
ptPrepare
.
checkTime
()
&&
trTimeout
.
change
(
tout
)
)
if
(
ptPrepare
.
checkTime
()
&&
trTimeout
.
change
(
tout
)
)
{
{
auto
w
=
shared_from_this
();
auto
w
=
shared_from_this
();
if
(
w
)
if
(
w
)
{
{
if
(
tout
)
if
(
tout
)
...
@@ -496,13 +501,13 @@ void UNetReceiver::stop()
...
@@ -496,13 +501,13 @@ void UNetReceiver::stop()
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
UNetReceiver
::
receive
()
bool
UNetReceiver
::
receive
()
{
{
// if( !udp->isInputReady(recvTimeout) )
// if( !udp->isInputReady(recvTimeout) )
// return false;
// return false;
//udp->UDPReceive::receive((char*)(r_buf.data), sizeof(r_buf.data));
//udp->UDPReceive::receive((char*)(r_buf.data), sizeof(r_buf.data));
//ssize_t ret = ::recv(udp->getSocket(),r_buf.data,sizeof(r_buf.data),0);
//ssize_t ret = ::recv(udp->getSocket(),r_buf.data,sizeof(r_buf.data),0);
ssize_t
ret
=
udp
->
receive
(
r_buf
.
data
,
sizeof
(
r_buf
.
data
));
ssize_t
ret
=
udp
->
receive
(
r_buf
.
data
,
sizeof
(
r_buf
.
data
));
if
(
ret
<
0
)
if
(
ret
<
0
)
{
{
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
15b81657
...
@@ -163,7 +163,10 @@ class UNetReceiver:
...
@@ -163,7 +163,10 @@ class UNetReceiver:
void
updateEvent
(
ev
::
periodic
&
watcher
,
int
revents
);
void
updateEvent
(
ev
::
periodic
&
watcher
,
int
revents
);
virtual
void
evprepare
(
const
ev
::
loop_ref
&
eloop
)
override
;
virtual
void
evprepare
(
const
ev
::
loop_ref
&
eloop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
eloop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
eloop
)
override
;
virtual
std
::
string
wname
(){
return
myname
;
}
virtual
std
::
string
wname
()
{
return
myname
;
}
void
initIterators
();
void
initIterators
();
...
...
extensions/UNetUDP/UNetSender.cc
View file @
15b81657
...
@@ -287,6 +287,7 @@ void UNetSender::real_send(UniSetUDP::UDPMessage& mypack)
...
@@ -287,6 +287,7 @@ void UNetSender::real_send(UniSetUDP::UDPMessage& mypack)
void
UNetSender
::
stop
()
void
UNetSender
::
stop
()
{
{
activated
=
false
;
activated
=
false
;
// s_thr->stop();
// s_thr->stop();
if
(
s_thr
)
if
(
s_thr
)
s_thr
->
join
();
s_thr
->
join
();
...
...
include/CommonEventLoop.h
View file @
15b81657
...
@@ -12,18 +12,21 @@
...
@@ -12,18 +12,21 @@
class
EvWatcher
class
EvWatcher
{
{
public
:
public
:
EvWatcher
(){}
EvWatcher
()
{}
virtual
~
EvWatcher
(){}
virtual
~
EvWatcher
()
{}
// подготовка перед запуском loop
// подготовка перед запуском loop
// запуск своих ev::xxx.start()
// запуск своих ev::xxx.start()
virtual
void
evprepare
(
const
ev
::
loop_ref
&
){}
virtual
void
evprepare
(
const
ev
::
loop_ref
&
)
{}
// действия при завершении
// действия при завершении
// завершение своих ev::xxx.stop()
// завершение своих ev::xxx.stop()
virtual
void
evfinish
(
const
ev
::
loop_ref
&
){}
virtual
void
evfinish
(
const
ev
::
loop_ref
&
)
{}
virtual
std
::
string
wname
(){
return
""
;
}
virtual
std
::
string
wname
()
{
return
""
;
}
};
};
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/*!
/*!
...
@@ -52,7 +55,10 @@ class CommonEventLoop
...
@@ -52,7 +55,10 @@ class CommonEventLoop
/*! \return TRUE - если это был последний EvWatcher и loop остановлен */
/*! \return TRUE - если это был последний EvWatcher и loop остановлен */
bool
evstop
(
EvWatcher
*
w
);
bool
evstop
(
EvWatcher
*
w
);
inline
const
ev
::
loop_ref
evloop
(){
return
loop
;
}
inline
const
ev
::
loop_ref
evloop
()
{
return
loop
;
}
protected
:
protected
:
...
...
include/EventLoopServer.h
View file @
15b81657
...
@@ -23,11 +23,11 @@ class EventLoopServer
...
@@ -23,11 +23,11 @@ class EventLoopServer
protected
:
protected
:
// действия при завершении
// действия при завершении
// завершение своих ev::xxx.stop()
// завершение своих ev::xxx.stop()
virtual
void
evfinish
(){}
virtual
void
evfinish
()
{}
// подготовка перед запуском loop
// подготовка перед запуском loop
// запусу своих ev::xxx.start()
// запусу своих ev::xxx.start()
virtual
void
evprepare
(){}
virtual
void
evprepare
()
{}
// Управление потоком событий
// Управление потоком событий
void
evrun
(
bool
thread
=
true
);
void
evrun
(
bool
thread
=
true
);
...
...
include/LogServer.h
View file @
15b81657
...
@@ -113,7 +113,10 @@ class LogServer:
...
@@ -113,7 +113,10 @@ class LogServer:
virtual
void
evprepare
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evprepare
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
std
::
string
wname
(){
return
myname
;
}
virtual
std
::
string
wname
()
{
return
myname
;
}
void
ioAccept
(
ev
::
io
&
watcher
,
int
revents
);
void
ioAccept
(
ev
::
io
&
watcher
,
int
revents
);
void
sessionFinished
(
LogSession
*
s
);
void
sessionFinished
(
LogSession
*
s
);
...
...
include/UDPCore.h
View file @
15b81657
...
@@ -12,13 +12,16 @@ class UDPSocketU:
...
@@ -12,13 +12,16 @@ class UDPSocketU:
{
{
public
:
public
:
UDPSocketU
(
const
ost
::
IPV4Address
&
bind
,
ost
::
tpport_t
port
)
:
UDPSocketU
(
const
ost
::
IPV4Address
&
bind
,
ost
::
tpport_t
port
)
:
ost
::
UDPSocket
(
bind
,
port
)
ost
::
UDPSocket
(
bind
,
port
)
{}
{}
virtual
~
UDPSocketU
(){}
virtual
~
UDPSocketU
()
{}
inline
SOCKET
getSocket
(){
return
ost
::
UDPSocket
::
so
;
}
inline
SOCKET
getSocket
()
{
return
ost
::
UDPSocket
::
so
;
}
};
};
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
class
UDPReceiveU
:
class
UDPReceiveU
:
...
@@ -26,14 +29,20 @@ class UDPReceiveU:
...
@@ -26,14 +29,20 @@ class UDPReceiveU:
{
{
public
:
public
:
UDPReceiveU
(
const
ost
::
IPV4Address
&
bind
,
ost
::
tpport_t
port
)
:
UDPReceiveU
(
const
ost
::
IPV4Address
&
bind
,
ost
::
tpport_t
port
)
:
ost
::
UDPReceive
(
bind
,
port
)
ost
::
UDPReceive
(
bind
,
port
)
{}
{}
virtual
~
UDPReceiveU
(){}
virtual
~
UDPReceiveU
()
{}
inline
SOCKET
getSocket
(){
return
ost
::
UDPReceive
::
so
;
}
inline
SOCKET
getSocket
()
inline
void
setCompletion
(
bool
set
){
ost
::
UDPReceive
::
setCompletion
(
set
);
}
{
return
ost
::
UDPReceive
::
so
;
}
inline
void
setCompletion
(
bool
set
)
{
ost
::
UDPReceive
::
setCompletion
(
set
);
}
};
};
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
class
UDPDuplexU
:
class
UDPDuplexU
:
...
@@ -41,14 +50,20 @@ class UDPDuplexU:
...
@@ -41,14 +50,20 @@ class UDPDuplexU:
{
{
public
:
public
:
UDPDuplexU
(
const
ost
::
IPV4Address
&
bind
,
ost
::
tpport_t
port
)
:
UDPDuplexU
(
const
ost
::
IPV4Address
&
bind
,
ost
::
tpport_t
port
)
:
ost
::
UDPDuplex
(
bind
,
port
)
ost
::
UDPDuplex
(
bind
,
port
)
{}
{}
virtual
~
UDPDuplexU
(){}
virtual
~
UDPDuplexU
()
{}
SOCKET
getReceiveSocket
(){
return
ost
::
UDPReceive
::
so
;
}
SOCKET
getReceiveSocket
()
void
setReceiveCompletion
(
bool
set
){
ost
::
UDPReceive
::
setCompletion
(
set
);
}
{
return
ost
::
UDPReceive
::
so
;
}
void
setReceiveCompletion
(
bool
set
)
{
ost
::
UDPReceive
::
setCompletion
(
set
);
}
};
};
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
#endif // UDPReceiveU_H_
#endif // UDPReceiveU_H_
...
...
include/USocket.h
0 → 100644
View file @
15b81657
// -------------------------------------------------------------------------
#ifndef USocket_H_
#define USocket_H_
// -------------------------------------------------------------------------
#include <cc++/socket.h>
// -------------------------------------------------------------------------
class
USocket
:
public
ost
::
Socket
{
public
:
// dup and accept...raw socket
USocket
(
int
sock
);
virtual
~
USocket
();
// set keepalive params
// return true if OK
bool
setKeepAliveParams
(
timeout_t
timeout_sec
=
5
,
int
conn_keepcnt
=
1
,
int
keepintvl
=
2
);
int
getSocket
();
protected
:
void
init
(
bool
throwflag
=
false
);
private
:
};
// -------------------------------------------------------------------------
#endif // USocket_H_
// -------------------------------------------------------------------------
include/modbus/ModbusTCPServer.h
View file @
15b81657
...
@@ -88,8 +88,6 @@ class ModbusTCPServer:
...
@@ -88,8 +88,6 @@ class ModbusTCPServer:
return
port
;
return
port
;
}
}
virtual
bool
isAcive
()
override
;
// -------------------------------------------------
// -------------------------------------------------
// Таймер.
// Таймер.
// Т.к. eventLoop() "бесконечный", то сделана возможность
// Т.к. eventLoop() "бесконечный", то сделана возможность
...
...
src/Communications/Modbus/ModbusTCPServer.cc
View file @
15b81657
...
@@ -183,12 +183,14 @@ void ModbusTCPServer::setTimer( timeout_t msec )
...
@@ -183,12 +183,14 @@ void ModbusTCPServer::setTimer( timeout_t msec )
if
(
msec
==
TIMEOUT_INF
)
if
(
msec
==
TIMEOUT_INF
)
{
{
tmTime
=
0
;
tmTime
=
0
;
if
(
ioTimer
.
is_active
()
)
if
(
ioTimer
.
is_active
()
)
ioTimer
.
stop
();
ioTimer
.
stop
();
}
}
else
else
{
{
tmTime
=
(
double
)
msec
/
1000.
;
tmTime
=
(
double
)
msec
/
1000.
;
if
(
ioTimer
.
is_active
()
)
if
(
ioTimer
.
is_active
()
)
ioTimer
.
start
(
tmTime
);
ioTimer
.
start
(
tmTime
);
}
}
...
...
src/Log/LogServer.cc
View file @
15b81657
...
@@ -207,6 +207,7 @@ void LogServer::ioAccept( ev::io& watcher, int revents )
...
@@ -207,6 +207,7 @@ void LogServer::ioAccept( ev::io& watcher, int revents )
void
LogServer
::
sessionFinished
(
LogSession
*
s
)
void
LogServer
::
sessionFinished
(
LogSession
*
s
)
{
{
uniset_rwmutex_wrlock
l
(
mutSList
);
uniset_rwmutex_wrlock
l
(
mutSList
);
for
(
SessionList
::
iterator
i
=
slist
.
begin
();
i
!=
slist
.
end
();
++
i
)
for
(
SessionList
::
iterator
i
=
slist
.
begin
();
i
!=
slist
.
end
();
++
i
)
{
{
if
(
i
->
get
()
==
s
)
if
(
i
->
get
()
==
s
)
...
...
src/Processes/CommonEventLoop.cc
View file @
15b81657
...
@@ -19,6 +19,7 @@ CommonEventLoop::~CommonEventLoop()
...
@@ -19,6 +19,7 @@ CommonEventLoop::~CommonEventLoop()
{
{
cancelled
=
true
;
cancelled
=
true
;
evterm
.
send
();
evterm
.
send
();
if
(
thr
)
if
(
thr
)
{
{
thr
->
join
();
thr
->
join
();
...
@@ -49,6 +50,7 @@ bool CommonEventLoop::evrun(EvWatcher* w, bool thread )
...
@@ -49,6 +50,7 @@ bool CommonEventLoop::evrun(EvWatcher* w, bool thread )
// ждём..
// ждём..
std
::
unique_lock
<
std
::
mutex
>
locker
(
prep_mutex
);
std
::
unique_lock
<
std
::
mutex
>
locker
(
prep_mutex
);
while
(
!
prep_notify
)
while
(
!
prep_notify
)
prep_event
.
wait
(
locker
);
prep_event
.
wait
(
locker
);
...
@@ -64,6 +66,7 @@ bool CommonEventLoop::evrun(EvWatcher* w, bool thread )
...
@@ -64,6 +66,7 @@ bool CommonEventLoop::evrun(EvWatcher* w, bool thread )
// ожидаем завершения основного потока..
// ожидаем завершения основного потока..
std
::
unique_lock
<
std
::
mutex
>
locker
(
term_mutex
);
std
::
unique_lock
<
std
::
mutex
>
locker
(
term_mutex
);
while
(
!
term_notify
)
while
(
!
term_notify
)
term_event
.
wait
(
locker
);
term_event
.
wait
(
locker
);
...
@@ -84,6 +87,7 @@ bool CommonEventLoop::evstop( EvWatcher* w )
...
@@ -84,6 +87,7 @@ bool CommonEventLoop::evstop( EvWatcher* w )
return
false
;
return
false
;
std
::
unique_lock
<
std
::
mutex
>
l
(
wlist_mutex
);
std
::
unique_lock
<
std
::
mutex
>
l
(
wlist_mutex
);
try
try
{
{
w
->
evfinish
(
loop
);
// для этого Watcher это уже finish..
w
->
evfinish
(
loop
);
// для этого Watcher это уже finish..
...
@@ -112,6 +116,7 @@ bool CommonEventLoop::evstop( EvWatcher* w )
...
@@ -112,6 +116,7 @@ bool CommonEventLoop::evstop( EvWatcher* w )
cancelled
=
false
;
cancelled
=
false
;
}
}
}
}
return
true
;
return
true
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -142,7 +147,7 @@ void CommonEventLoop::onStop()
...
@@ -142,7 +147,7 @@ void CommonEventLoop::onStop()
// потому-что onStop будет вызываться
// потому-что onStop будет вызываться
// из evstop, где он уже будет под "блокировкой"
// из evstop, где он уже будет под "блокировкой"
// т.е. чтобы не получить deadlock
// т.е. чтобы не получить deadlock
for
(
const
auto
&
w
:
wlist
)
for
(
const
auto
&
w
:
wlist
)
{
{
try
try
{
{
...
...
src/Processes/EventLoopServer.cc
View file @
15b81657
...
@@ -41,6 +41,7 @@ void EventLoopServer::evstop()
...
@@ -41,6 +41,7 @@ void EventLoopServer::evstop()
{
{
cancelled
=
true
;
cancelled
=
true
;
evterm
.
send
();
evterm
.
send
();
if
(
thr
)
if
(
thr
)
{
{
thr
->
join
();
thr
->
join
();
...
...
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