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
9f437a81
Commit
9f437a81
authored
Oct 21, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(LogServer): починил проверку и переоткрытие сокета в функции check
parent
63ac267d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+3
-0
LogServer.cc
src/Log/LogServer.cc
+31
-8
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
9f437a81
...
@@ -476,7 +476,10 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSysCommand( const SystemMessage*
...
@@ -476,7 +476,10 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSysCommand( const SystemMessage*
}
}
if( logserv
&&
!logserv_host.empty()
&&
logserv_port != 0 )
if( logserv
&&
!logserv_host.empty()
&&
logserv_port != 0 )
{
mylogany
<<
myname
<<
"(preSysCommand): try restart logserver.."
<<
endl;
logserv-
>
check(true);
logserv-
>
check(true);
}
}
}
break;
break;
...
...
src/Log/LogServer.cc
View file @
9f437a81
...
@@ -131,11 +131,15 @@ void LogServer::terminate()
...
@@ -131,11 +131,15 @@ void LogServer::terminate()
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
bool
LogServer
::
check
(
bool
restart_if_fail
)
bool
LogServer
::
check
(
bool
restart_if_fail
)
{
{
// смущает пока только, что эта функция будет вызыватся (обычно) из другого потока
// и как к этому отнесётся evloop
try
try
{
{
// для проверки пробуем открыть соединение..
// для проверки пробуем открыть соединение..
UTCPSocket
s
(
addr
,
port
);
UTCPStream
s
;
s
.
close
();
s
.
create
(
addr
,
port
,
500
);
s
.
disconnect
();
return
true
;
return
true
;
}
}
catch
(...)
{}
catch
(...)
{}
...
@@ -143,17 +147,36 @@ bool LogServer::check( bool restart_if_fail )
...
@@ -143,17 +147,36 @@ bool LogServer::check( bool restart_if_fail )
if
(
!
restart_if_fail
)
if
(
!
restart_if_fail
)
return
false
;
return
false
;
io
.
stop
();
if
(
!
sock
)
if
(
!
sock
)
return
false
;
{
try
{
evprepare
(
io
.
loop
);
}
catch
(
UniSetTypes
::
SystemError
&
ex
)
{
if
(
mylog
.
is_crit
()
)
mylog
.
crit
()
<<
myname
<<
"(evprepare): "
<<
ex
<<
endl
;
io
.
stop
();
return
false
;
io
.
set
<
LogServer
,
&
LogServer
::
ioAccept
>
(
this
);
}
io
.
start
(
sock
->
getSocket
(),
ev
::
READ
);
}
if
(
!
io
.
is_active
()
)
{
io
.
set
<
LogServer
,
&
LogServer
::
ioAccept
>
(
this
);
io
.
start
(
sock
->
getSocket
(),
ev
::
READ
);
isrunning
=
true
;
}
// Проверяем..
try
try
{
{
UTCPSocket
s
(
addr
,
port
);
UTCPStream
s
;
s
.
close
();
s
.
create
(
addr
,
port
,
500
);
s
.
disconnect
();
return
true
;
return
true
;
}
}
catch
(
Poco
::
Net
::
NetException
&
ex
)
catch
(
Poco
::
Net
::
NetException
&
ex
)
...
...
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