mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix #1629, fix kickoff FLV client bug. 3.0.137
This commit is contained in:
parent
850a4bbf20
commit
0dd6c31487
5 changed files with 40 additions and 17 deletions
|
@ -198,19 +198,32 @@ srs_error_t SrsResponseOnlyHttpConn::pop_message(ISrsHttpMessage** preq)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsStSocket skt;
|
||||
|
||||
|
||||
if ((err = skt.initialize(stfd)) != srs_success) {
|
||||
return srs_error_wrap(err, "init socket");
|
||||
}
|
||||
|
||||
if ((err = parser->parse_message(&skt, preq)) != srs_success) {
|
||||
return srs_error_wrap(err, "parse message");
|
||||
|
||||
// Check user interrupt by interval.
|
||||
skt.set_recv_timeout(3 * SRS_UTIME_SECONDS);
|
||||
|
||||
// drop all request body.
|
||||
char body[4096];
|
||||
while (true) {
|
||||
if ((err = trd->pull()) != srs_success) {
|
||||
return srs_error_wrap(err, "timeout");
|
||||
}
|
||||
|
||||
if ((err = skt.read(body, 4096, NULL)) != srs_success) {
|
||||
// Because we use timeout to check trd state, so we should ignore any timeout.
|
||||
if (srs_error_code(err) == ERROR_SOCKET_TIMEOUT) {
|
||||
srs_freep(err);
|
||||
continue;
|
||||
}
|
||||
|
||||
return srs_error_wrap(err, "read response");
|
||||
}
|
||||
}
|
||||
|
||||
// Attach owner connection to message.
|
||||
SrsHttpMessage* hreq = (SrsHttpMessage*)(*preq);
|
||||
hreq->set_connection(this);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -219,12 +232,12 @@ srs_error_t SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
ISrsHttpResponseReader* br = msg->body_reader();
|
||||
|
||||
|
||||
// when not specified the content length, ignore.
|
||||
if (msg->content_length() == -1) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
// drop all request body.
|
||||
char body[4096];
|
||||
while (!br->eof()) {
|
||||
|
@ -236,6 +249,11 @@ srs_error_t SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsResponseOnlyHttpConn::expire()
|
||||
{
|
||||
SrsHttpConn::expire();
|
||||
}
|
||||
|
||||
SrsHttpServer::SrsHttpServer(SrsServer* svr)
|
||||
{
|
||||
server = svr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue