Closed shenlei190810 closed 2 years ago
Hi @shenlei190810,
Thank for you reporting an issue and helping improve Kaltura!
To get the fastest response time, and help the maintainers review and test your reported issues or suggestions, please ensure that your issue includes the following (please comment with more info if you have not included all this info in your original issue):
# rpm -qa \"kaltura*\"
For deb based systems:
# dpkg -l \"kaltura-*\"
# tail -f /opt/kaltura/log/*.log /opt/kaltura/log/batch/*.log | grep -A 1 -B 1 --color \"ERR:\|PHP\|trace\|CRIT\|\[error\]\"
and paste the output.
For general troubleshooting see: https://github.com/kaltura/platform-install-packages/blob/Jupiter-10.13.0/doc/kaltura-packages-faq.md#troubleshooting-help
If you only have a general question rather than a bug report, please close this issue and post at: http://forum.kaltura.org
Thank you in advance,
can you explain what you meant by "this function"? are you asking about ngx_srt_chain_insert_head or ngx_srt_conn_post_ngx?
ngx_srt_conn_post_ngx,this function。
As I wrote on the prev issue, these functions are used for posting messages between the SRT thread and the nginx main thread. In this case, after the send is done on the SRT thread, it sends a write event to the main thread. Once the main nginx thread receives this notification, it calls the write handler of the connection - https://github.com/kaltura/nginx-srt-module/blob/master/src/ngx_srt_connection.c#L135 In the case of proxy (TCP->SRT or SRT->TCP), eventually, this would lead to the execution of ngx_srt_proxy_process_ngx_to_srt, which could trigger another recv on the TCP connection, and send any received data to the SRT thread.
ngx_srt_proxy_process_ngx_to_srt
yes. but in ngx_srt_proxy_process_ngx_to_srt function, there is a for loop, all tcp data can be recevied. if after this loop, more tcp data comes, it also will trige ngx_srt_proxy_process_ngx_to_srt function. all the above, I don't know reason you call ngx_srt_conn_post_ngx to notify nginx thread all data have sended by srt thread;because without it, all tcp data also can be transfered to srt thread. am i right? thank you very much
The reason this code is needed is because the buffer may get full, and then the module will not issue any more recv's. In this case, only when the send completes and the buffer is freed, the module can call recv again. This is why this code is required...
The reason this code is needed is because the buffer may get full, and then the module will not issue any more recv's. In this case, only when the send completes and the buffer is freed, the module can call recv again. This is why this code is required...
yes, you are right, but when I read nginx stream proxy module, after sent out some data, there is no this code. Do you know why? Is that a mistake?
It works in the same way in the stream proxy module... there it's a bit simpler because the two connections are of the same type, the code is symmetrical, and a single function can handle both cases. If you check the code, you'll see that ngx_stream_proxy_process_connection is called in 4 cases - (upstream, downstream) x (read, write). The reason it's called on write events is to handle the case of buffer full, that I referred to above. Here, we have the same 4 cases, but 2 are handled by ngx_to_srt and 2 are handled by srt_to_ngx.
It works in the same way in the stream proxy module... there it's a bit simpler because the two connections are of the same type, the code is symmetrical, and a single function can handle both cases. If you check the code, you'll see that ngx_stream_proxy_process_connection is called in 4 cases - (upstream, downstream) x (read, write). The reason it's called on write events is to handle the case of buffer full, that I referred to above. Here, we have the same 4 cases, but 2 are handled by ngx_to_srt and 2 are handled by srt_to_ngx.
thank you very much for your answer, that helps me a lot.
here is your function: ` static ngx_int_t ngx_srt_conn_send(ngx_srt_conn_t sc) { int n; int serr, serrno; size_t sent; size_t size; ngx_buf_t b; SRTSOCKET ss; ngx_chain_t out, cl;
done: if (sent) { sc->connection->sent += sent;
}`
after srt_send data , you call this function below, can you explain why it is needed ? thank you very much.