Module: kamailio
Branch: master
Commit: 4deb51419ab66931459709fe44acd3e7a0acc18d
URL: https://github.com/kamailio/kamailio/commit/4deb51419ab66931459709fe44acd3e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-06-03T12:45:05+02:00
core: tcp - log details of the exiting tcp connection on insert failure
---
Modified: src/core/tcp_read.c
---
Diff: https://github.com/kamailio/kamailio/commit/4deb51419ab66931459709fe44acd3e…
Patch: https://github.com/kamailio/kamailio/commit/4deb51419ab66931459709fe44acd3e…
---
diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c
index 8147951b21..db6e8b923a 100644
--- a/src/core/tcp_read.c
+++ b/src/core/tcp_read.c
@@ -1720,7 +1720,7 @@ static ticks_t tcpconn_read_timeout(ticks_t t, struct timer_ln* tl, void* data)
* idx - index in the fd_array (or -1 if not known)
* return: -1 on error, or when we are not interested any more on reads
* from this fd (e.g.: we are closing it )
- * 0 on EAGAIN or when by some other way it is known that no more
+ * 0 on EAGAIN or when by some other way it is known that no more
* io events are queued on the fd (the receive buffer is empty).
* Usefull to detect when there are no more io events queued for
* sigio_rt, epoll_et, kqueue.
@@ -1728,7 +1728,7 @@ static ticks_t tcpconn_read_timeout(ticks_t t, struct timer_ln* tl, void* data)
* queued -- the receive buffer might still be non-empty)
*/
inline static int handle_io(struct fd_map* fm, short events, int idx)
-{
+{
int ret;
int n;
int read_flags;
@@ -1736,10 +1736,11 @@ inline static int handle_io(struct fd_map* fm, short events, int idx)
int s;
long resp;
ticks_t t;
-
+ fd_map_t *ee = NULL;
+
/* update the local config */
cfg_update();
-
+
switch(fm->type){
case F_TCPMAIN:
again:
@@ -1803,7 +1804,7 @@ inline static int handle_io(struct fd_map* fm, short events, int idx)
if (unlikely(read_flags & RD_CONN_REPEAT_READ))
goto repeat_1st_read;
#endif /* USE_TLS */
-
+
/* must be before io_watch_add, io_watch_add might catch some
* already existing events => might call handle_io and
* handle_io might decide to del. the new connection =>
@@ -1816,13 +1817,25 @@ inline static int handle_io(struct fd_map* fm, short events, int idx)
local_timer_reinit(&con->timer);
local_timer_add(&tcp_reader_ltimer, &con->timer,
S_TO_TICKS(TCP_CHILD_TIMEOUT), t);
- if (unlikely(io_watch_add(&io_w, s, POLLIN, F_TCPCONN, con)<0)){
+ if (unlikely(io_watch_add(&io_w, s, POLLIN, F_TCPCONN, con)<0)) {
LM_CRIT("io_watch_add failed for %p id %d fd %d, state %d, flags %x,"
" main fd %d, refcnt %d ([%s]:%u -> [%s]:%u)\n",
con, con->id, con->fd, con->state, con->flags,
con->s, atomic_get(&con->refcnt),
ip_addr2a(&con->rcv.src_ip), con->rcv.src_port,
ip_addr2a(&con->rcv.dst_ip), con->rcv.dst_port);
+ ee = get_fd_map(&io_w, s);
+ if(ee!=0 && ee->type==F_TCPCONN) {
+ tcp_connection_t *ec;
+ ec = (tcp_connection_t*)ee->data;
+ LM_CRIT("existing tcp con %p id %d fd %d, state %d, flags %x,"
+ " main fd %d, refcnt %d ([%s]:%u -> [%s]:%u)\n",
+ ec, ec->id, ec->fd, ec->state, ec->flags,
+ ec->s, atomic_get(&ec->refcnt),
+ ip_addr2a(&ec->rcv.src_ip), ec->rcv.src_port,
+ ip_addr2a(&ec->rcv.dst_ip), ec->rcv.dst_port);
+
+ }
tcpconn_listrm(tcp_conn_lst, con, c_next, c_prev);
local_timer_del(&tcp_reader_ltimer, &con->timer);
goto con_error;
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for feature requests.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If you submit a feature request (or enhancement) add the description of what you would like to be added.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
With rtpengine module play_media function it is possible to play media to one of the endpoints(Kamailio is normal proxy) but I like to use Kamailio+rtpengine as an end point playing music for caller(simple media server).
### Expected behavior
Possible to use Kamailio+rtpengine as an end point playing media.
### Possible Solutions
I see some efforts in mailing list trying to build/generate a 183 response inside script to simulate a dummy end point and then use rtpengine_play_media function.
<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a improvement.
-->
Regards.
Babak
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2315