Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
447
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
e67222c6
Commit
e67222c6
authored
4 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
http: HTTP/2 write function
parent
62be79b1
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/access/http/h2conn.c
+91
-1
91 additions, 1 deletion
modules/access/http/h2conn.c
with
91 additions
and
1 deletion
modules/access/http/h2conn.c
+
91
−
1
View file @
e67222c6
...
...
@@ -282,6 +282,96 @@ static struct vlc_http_msg *vlc_h2_stream_wait(struct vlc_http_stream *stream)
return
m
;
}
static
ssize_t
vlc_h2_stream_write
(
struct
vlc_http_stream
*
stream
,
const
void
*
base
,
size_t
length
,
bool
eos
)
{
struct
vlc_h2_stream
*
s
=
container_of
(
stream
,
struct
vlc_h2_stream
,
stream
);
struct
vlc_h2_conn
*
conn
=
s
->
conn
;
ssize_t
total
=
0
;
int
err
=
0
;
if
(
unlikely
(
length
==
0
&&
!
eos
))
return
0
;
vlc_h2_stream_lock
(
s
);
do
{
size_t
size
=
length
;
/* This and the following flow control comparison and subtraction all
* assumes that we do *not* use any padding on the data frames.
*/
if
(
size
>
conn
->
max_send_frame
)
size
=
conn
->
max_send_frame
;
/* Stream flow control */
if
(
size
>
s
->
send_cwnd
)
size
=
s
->
send_cwnd
;
if
(
size
==
0
&&
length
>
0
)
{
if
(
s
->
interrupted
)
{
err
=
EINTR
;
break
;
}
mutex_cleanup_push
(
&
conn
->
lock
);
vlc_cond_wait
(
&
s
->
send_wait
,
&
conn
->
lock
);
vlc_cleanup_pop
();
continue
;
}
/* Connection flow control */
if
(
size
>
conn
->
send_cwnd
)
size
=
conn
->
send_cwnd
;
if
(
size
==
0
&&
length
>
0
)
{
if
(
s
->
interrupted
)
{
err
=
EINTR
;
break
;
}
mutex_cleanup_push
(
&
conn
->
lock
);
vlc_cond_wait
(
&
conn
->
send_wait
,
&
conn
->
lock
);
vlc_cleanup_pop
();
continue
;
}
/* Frame send */
bool
end
=
eos
&&
length
==
size
;
struct
vlc_h2_frame
*
f
=
vlc_h2_frame_data
(
s
->
id
,
base
,
size
,
end
);
if
(
f
==
NULL
)
{
err
=
ENOMEM
;
break
;
}
if
(
vlc_h2_conn_queue
(
conn
,
f
))
{
err
=
ECONNRESET
;
break
;
}
base
=
(
const
char
*
)
base
+
size
;
length
-=
size
;
total
+=
size
;
s
->
send_cwnd
-=
size
;
conn
->
send_cwnd
-=
size
;
}
while
(
length
>
0
);
vlc_h2_stream_unlock
(
s
);
if
(
total
==
0
&&
err
!=
0
)
{
errno
=
err
;
total
=
-
1
;
}
return
total
;
}
/**
* Receives stream data.
*
...
...
@@ -404,7 +494,7 @@ static void vlc_h2_stream_close(struct vlc_http_stream *stream, bool aborted)
static
const
struct
vlc_http_stream_cbs
vlc_h2_stream_callbacks
=
{
vlc_h2_stream_wait
,
NULL
,
vlc_h2_stream_write
,
vlc_h2_stream_read
,
vlc_h2_stream_close
,
};
...
...
This diff is collapsed.
Click to expand it.
Rémi Denis-Courmont
@Courmisch
mentioned in issue
#19998 (closed)
·
4 years ago
mentioned in issue
#19998 (closed)
mentioned in issue #19998
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment