Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
2225738a
Commit
2225738a
authored
May 08, 2002
by
Michael Smith
Browse files
Ensure we don't throw away a buffer after only sending part of it.
svn path=/trunk/icecast/; revision=3290
parent
59b605ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/source.c
View file @
2225738a
...
...
@@ -217,14 +217,21 @@ void *source_main(void *arg)
bytes
=
abuf
->
len
;
sbytes
=
sock_write_bytes
(
client
->
con
->
sock
,
&
abuf
->
data
[
client
->
pos
],
bytes
);
if
(
sbytes
>=
0
)
client
->
con
->
sent_bytes
+=
sbytes
;
if
(
sbytes
>=
0
)
{
client
->
con
->
sent_bytes
+=
sbytes
;
if
(
sbytes
!=
bytes
)
{
client
->
pos
+=
sbytes
;
refbuf_queue_insert
(
&
client
->
queue
,
abuf
);
data_done
=
1
;
break
;
}
}
if
(
sbytes
<
0
)
{
if
(
!
sock_recoverable
(
sock_error
()))
{
printf
(
"SOURCE: Client had unrecoverable error catching up (%ld/%ld)
\n
"
,
sbytes
,
bytes
);
client
->
con
->
error
=
1
;
}
else
{
printf
(
"SOURCE: client had recoverable error...
\n
"
);
client
->
pos
+=
sbytes
>
0
?
sbytes
:
0
;
/* put the refbuf back on top of the queue, since we didn't finish with it */
refbuf_queue_insert
(
&
client
->
queue
,
abuf
);
}
...
...
@@ -246,7 +253,14 @@ void *source_main(void *arg)
refbuf_queue_add
(
&
client
->
queue
,
refbuf
);
}
else
{
sbytes
=
sock_write_bytes
(
client
->
con
->
sock
,
refbuf
->
data
,
refbuf
->
len
);
if
(
sbytes
>=
0
)
client
->
con
->
sent_bytes
+=
sbytes
;
if
(
sbytes
>=
0
)
{
client
->
con
->
sent_bytes
+=
sbytes
;
if
(
sbytes
!=
bytes
)
{
client
->
pos
=
sbytes
;
refbuf_addref
(
refbuf
);
refbuf_queue_insert
(
&
client
->
queue
,
abuf
);
}
}
if
(
sbytes
<
0
)
{
bytes
=
sock_error
();
if
(
!
sock_recoverable
(
bytes
))
{
...
...
@@ -254,7 +268,7 @@ void *source_main(void *arg)
client
->
con
->
error
=
1
;
}
else
{
printf
(
"SOURCE: recoverable error %ld
\n
"
,
bytes
);
client
->
pos
=
sbytes
>
0
?
sbytes
:
0
;
client
->
pos
=
0
;
refbuf_addref
(
refbuf
);
refbuf_queue_insert
(
&
client
->
queue
,
refbuf
);
}
...
...
Write
Preview
Supports
Markdown
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