正在显示
4 个修改的文件
包含
13 行增加
和
1 行删除
| @@ -523,6 +523,10 @@ int SrsHttpApi::do_cycle() | @@ -523,6 +523,10 @@ int SrsHttpApi::do_cycle() | ||
| 523 | // underlayer socket | 523 | // underlayer socket |
| 524 | SrsStSocket skt(stfd); | 524 | SrsStSocket skt(stfd); |
| 525 | 525 | ||
| 526 | + // set the recv timeout, for some clients never disconnect the connection. | ||
| 527 | + // @see https://github.com/simple-rtmp-server/srs/issues/398 | ||
| 528 | + skt.set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US); | ||
| 529 | + | ||
| 526 | // process http messages. | 530 | // process http messages. |
| 527 | for (;;) { | 531 | for (;;) { |
| 528 | SrsHttpMessage* req = NULL; | 532 | SrsHttpMessage* req = NULL; |
| @@ -1383,6 +1383,10 @@ int SrsHttpConn::do_cycle() | @@ -1383,6 +1383,10 @@ int SrsHttpConn::do_cycle() | ||
| 1383 | // underlayer socket | 1383 | // underlayer socket |
| 1384 | SrsStSocket skt(stfd); | 1384 | SrsStSocket skt(stfd); |
| 1385 | 1385 | ||
| 1386 | + // set the recv timeout, for some clients never disconnect the connection. | ||
| 1387 | + // @see https://github.com/simple-rtmp-server/srs/issues/398 | ||
| 1388 | + skt.set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US); | ||
| 1389 | + | ||
| 1386 | // process http messages. | 1390 | // process http messages. |
| 1387 | for (;;) { | 1391 | for (;;) { |
| 1388 | SrsHttpMessage* req = NULL; | 1392 | SrsHttpMessage* req = NULL; |
| @@ -201,6 +201,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -201,6 +201,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 201 | // query string seprator | 201 | // query string seprator |
| 202 | #define SRS_CONSTS_HTTP_QUERY_SEP '?' | 202 | #define SRS_CONSTS_HTTP_QUERY_SEP '?' |
| 203 | 203 | ||
| 204 | +// the default recv timeout. | ||
| 205 | +#define SRS_HTTP_RECV_TIMEOUT_US 60 * 1000 * 1000 | ||
| 206 | + | ||
| 204 | // 6.1.1 Status Code and Reason Phrase | 207 | // 6.1.1 Status Code and Reason Phrase |
| 205 | #define SRS_CONSTS_HTTP_Continue 100 | 208 | #define SRS_CONSTS_HTTP_Continue 100 |
| 206 | #define SRS_CONSTS_HTTP_SwitchingProtocols 101 | 209 | #define SRS_CONSTS_HTTP_SwitchingProtocols 101 |
| @@ -33,6 +33,7 @@ bool srs_is_client_gracefully_close(int error_code) | @@ -33,6 +33,7 @@ bool srs_is_client_gracefully_close(int error_code) | ||
| 33 | { | 33 | { |
| 34 | return error_code == ERROR_SOCKET_READ | 34 | return error_code == ERROR_SOCKET_READ |
| 35 | || error_code == ERROR_SOCKET_READ_FULLY | 35 | || error_code == ERROR_SOCKET_READ_FULLY |
| 36 | - || error_code == ERROR_SOCKET_WRITE; | 36 | + || error_code == ERROR_SOCKET_WRITE |
| 37 | + || error_code == ERROR_SOCKET_TIMEOUT; | ||
| 37 | } | 38 | } |
| 38 | 39 |
-
请 注册 或 登录 后发表评论