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
4710006b
Commit
4710006b
authored
Mar 13, 2021
by
Pavel Vainerman
Committed by
Pavel Vainerman
May 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[uwebsocket]: ping/pong processing
parent
400cfbe2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
UWebSocketGate.cc
extensions/UWebSocketGate/UWebSocketGate.cc
+10
-10
UWebSocketGate.h
extensions/UWebSocketGate/UWebSocketGate.h
+1
-1
start_fg.sh
extensions/UWebSocketGate/start_fg.sh
+1
-1
No files found.
extensions/UWebSocketGate/UWebSocketGate.cc
View file @
4710006b
...
...
@@ -726,6 +726,9 @@ void UWebSocketGate::UWebSocket::read( ev::io& io, int revents )
if
(
!
(
revents
&
EV_READ
)
)
return
;
if
(
cancelled
)
return
;
using
Poco
::
Net
::
WebSocket
;
using
Poco
::
Net
::
WebSocketException
;
using
Poco
::
Net
::
HTTPResponse
;
...
...
@@ -749,6 +752,10 @@ void UWebSocketGate::UWebSocket::read( ev::io& io, int revents )
return
;
}
if
(
(
flags
&
WebSocket
::
FRAME_OP_BITMASK
)
==
WebSocket
::
FRAME_OP_PONG
)
return
;
if
(
(
flags
&
WebSocket
::
FRAME_OP_BITMASK
)
==
WebSocket
::
FRAME_OP_CLOSE
)
{
term
();
...
...
@@ -978,21 +985,14 @@ void UWebSocketGate::UWebSocket::onCommand( const string& cmdtxt )
mylog3
<<
"(websocket): "
<<
req
->
clientAddress
().
toString
()
<<
" error: bad command format '"
<<
cmdtxt
<<
"'. Len must be > 4"
<<
endl
;
using
Poco
::
Net
::
WebSocket
;
using
Poco
::
Net
::
WebSocketException
;
using
Poco
::
Net
::
HTTPResponse
;
using
Poco
::
Net
::
HTTPServerRequest
;
resp
->
setStatusAndReason
(
HTTPResponse
::
HTTP_BAD_REQUEST
);
resp
->
setContentLength
(
0
);
resp
->
send
();
sendError
(
"Unknown command. Command must be > 4 bytes"
);
return
;
}
const
string
cmd
=
cmdtxt
.
substr
(
0
,
3
);
const
string
params
=
cmdtxt
.
substr
(
4
,
cmdtxt
.
size
()
);
const
string
params
=
cmdtxt
.
substr
(
4
);
myinfo
<<
"(websocket): "
<<
req
->
clientAddress
().
toString
()
myinfo
<<
"(websocket)
(command)
: "
<<
req
->
clientAddress
().
toString
()
<<
"("
<<
cmd
<<
"): "
<<
params
<<
endl
;
if
(
cmd
==
"set"
)
...
...
extensions/UWebSocketGate/UWebSocketGate.h
View file @
4710006b
...
...
@@ -325,7 +325,7 @@ namespace uniset
double
send_sec
=
{
0
.
5
};
size_t
maxsend
=
{
5000
};
size_t
maxcmd
=
{
200
};
static
int
Kbuf
=
{
10
};
// коэффициент для буфера сообщений (maxsend умножается на Kbuf)
const
int
Kbuf
=
{
10
};
// коэффициент для буфера сообщений (maxsend умножается на Kbuf)
ev
::
timer
ioping
;
double
ping_sec
=
{
3
.
0
};
...
...
extensions/UWebSocketGate/start_fg.sh
View file @
4710006b
...
...
@@ -2,4 +2,4 @@
ulimit
-Sc
1000000
uniset2-start.sh
-f
./uniset2-wsgate
--confile
test.xml
--ws-name
UWebSocketGate1
--ws-log-add-levels
crit,warn,level1
$*
uniset2-start.sh
-f
./uniset2-wsgate
--confile
test.xml
--ws-name
UWebSocketGate1
--ws-log-add-levels
any
$*
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