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
693d165b
Commit
693d165b
authored
Jul 29, 2021
by
Pavel Vainerman
Committed by
Pavel Vainerman
Oct 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[uwebsocket]: fixed libev error (double attach to signals)
parent
a8c6f301
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
UWebSocketGate.cc
extensions/UWebSocketGate/UWebSocketGate.cc
+9
-9
UWebSocketGate.h
extensions/UWebSocketGate/UWebSocketGate.h
+3
-4
No files found.
extensions/UWebSocketGate/UWebSocketGate.cc
View file @
693d165b
...
...
@@ -76,8 +76,6 @@ UWebSocketGate::UWebSocketGate( uniset::ObjectId id
wsactivate
.
set
<
UWebSocketGate
,
&
UWebSocketGate
::
onActivate
>
(
this
);
wscmd
->
set
<
UWebSocketGate
,
&
UWebSocketGate
::
onCommand
>
(
this
);
sigTERM
.
set
<
UWebSocketGate
,
&
UWebSocketGate
::
onTerminate
>
(
this
);
sigQUIT
.
set
<
UWebSocketGate
,
&
UWebSocketGate
::
onTerminate
>
(
this
);
sigINT
.
set
<
UWebSocketGate
,
&
UWebSocketGate
::
onTerminate
>
(
this
);
iocheck
.
set
<
UWebSocketGate
,
&
UWebSocketGate
::
checkMessages
>
(
this
);
maxMessagesProcessing
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"max-messages-processing"
,
conf
->
getField
(
"maxMessagesProcessing"
),
maxMessagesProcessing
);
...
...
@@ -180,7 +178,7 @@ UWebSocketGate::~UWebSocketGate()
runlock
->
unlock
();
}
//--------------------------------------------------------------------------------------------
void
UWebSocketGate
::
onTerminate
(
ev
::
sig
&
evsig
,
int
revents
)
void
UWebSocketGate
::
onTerminate
(
ev
::
async
&
watcher
,
int
revents
)
{
if
(
EV_ERROR
&
revents
)
{
...
...
@@ -190,7 +188,7 @@ void UWebSocketGate::onTerminate( ev::sig& evsig, int revents )
myinfo
<<
myname
<<
"(onTerminate): terminate..."
<<
endl
;
evsig
.
stop
();
watcher
.
stop
();
//evsig.loop.break_loop();
try
...
...
@@ -383,11 +381,7 @@ void UWebSocketGate::evprepare()
wscmd
->
start
();
sigTERM
.
set
(
loop
);
sigTERM
.
start
(
SIGTERM
);
sigQUIT
.
set
(
loop
);
sigQUIT
.
start
(
SIGQUIT
);
sigINT
.
set
(
loop
);
sigINT
.
start
(
SIGINT
);
sigTERM
.
start
();
iocheck
.
set
(
loop
);
iocheck
.
start
(
0
,
check_sec
);
...
...
@@ -618,6 +612,12 @@ void UWebSocketGate::onWebSocketSession( Poco::Net::HTTPServerRequest& req, Poco
myinfoV
(
3
)
<<
myname
<<
"(onWebSocketSession): finish session for "
<<
req
.
clientAddress
().
toString
()
<<
endl
;
}
// -----------------------------------------------------------------------------
bool
UWebSocketGate
::
deactivateObject
()
{
sigTERM
.
send
();
return
UniSetObject
::
deactivateObject
();
}
// -----------------------------------------------------------------------------
bool
UWebSocketGate
::
activateObject
()
{
bool
ret
=
UniSetObject
::
activateObject
();
...
...
extensions/UWebSocketGate/UWebSocketGate.h
View file @
693d165b
...
...
@@ -223,6 +223,7 @@ namespace uniset
class
UWebSocket
;
virtual
bool
activateObject
()
override
;
virtual
bool
deactivateObject
()
override
;
void
run
(
bool
async
);
virtual
void
evfinish
()
override
;
virtual
void
evprepare
()
override
;
...
...
@@ -241,10 +242,8 @@ namespace uniset
Poco
::
JSON
::
Object
::
Ptr
respError
(
Poco
::
Net
::
HTTPServerResponse
&
resp
,
Poco
::
Net
::
HTTPResponse
::
HTTPStatus
s
,
const
std
::
string
&
message
);
void
makeResponseAccessHeader
(
Poco
::
Net
::
HTTPServerResponse
&
resp
);
#endif
ev
::
sig
sigTERM
;
ev
::
sig
sigQUIT
;
ev
::
sig
sigINT
;
void
onTerminate
(
ev
::
sig
&
evsig
,
int
revents
);
ev
::
async
sigTERM
;
void
onTerminate
(
ev
::
async
&
watcher
,
int
revents
);
ev
::
async
wsactivate
;
// активация WebSocket-ов
std
::
shared_ptr
<
ev
::
async
>
wscmd
;
...
...
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