Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
260597d5
Commit
260597d5
authored
Feb 15, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure actions happen in order.
parent
9ba10372
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
rtpconn/webclient.go
rtpconn/webclient.go
+13
-16
No files found.
rtpconn/webclient.go
View file @
260597d5
...
...
@@ -62,7 +62,7 @@ type webClient struct {
done
chan
struct
{}
writeCh
chan
interface
{}
writerDone
chan
struct
{}
actionCh
chan
interface
{}
actionCh
chan
struct
{}
mu
sync
.
Mutex
down
map
[
string
]
*
rtpDownConnection
...
...
@@ -739,7 +739,7 @@ func StartClient(conn *websocket.Conn) (err error) {
c
:=
&
webClient
{
id
:
m
.
Id
,
actionCh
:
make
(
chan
interface
{},
10
),
actionCh
:
make
(
chan
struct
{},
1
),
done
:
make
(
chan
struct
{}),
}
...
...
@@ -810,13 +810,6 @@ func clientLoop(c *webClient, ws *websocket.Conn) error {
}
for
{
c
.
mu
.
Lock
()
actions
:=
c
.
actions
c
.
actions
=
nil
c
.
mu
.
Unlock
()
for
_
,
a
:=
range
actions
{
handleAction
(
c
,
a
)
}
select
{
case
m
,
ok
:=
<-
read
:
if
!
ok
{
...
...
@@ -832,10 +825,13 @@ func clientLoop(c *webClient, ws *websocket.Conn) error {
case
error
:
return
m
}
case
a
:=
<-
c
.
actionCh
:
err
:=
handleAction
(
c
,
a
)
if
err
!=
nil
{
return
err
case
<-
c
.
actionCh
:
c
.
mu
.
Lock
()
actions
:=
c
.
actions
c
.
actions
=
nil
c
.
mu
.
Unlock
()
for
_
,
a
:=
range
actions
{
handleAction
(
c
,
a
)
}
case
<-
ticker
.
C
:
if
time
.
Since
(
readTime
)
>
75
*
time
.
Second
{
...
...
@@ -1551,16 +1547,17 @@ var ErrClientDead = errors.New("client is dead")
func
(
c
*
webClient
)
action
(
a
interface
{})
error
{
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
if
len
(
c
.
actions
)
==
0
{
empty
:=
len
(
c
.
actions
)
==
0
c
.
actions
=
append
(
c
.
actions
,
a
)
if
empty
{
select
{
case
c
.
actionCh
<-
a
:
case
c
.
actionCh
<-
struct
{}{}
:
return
nil
case
<-
c
.
done
:
return
ErrClientDead
default
:
}
}
c
.
actions
=
append
(
c
.
actions
,
a
)
return
nil
}
...
...
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