On Nov 15, 2011 at 14:43, Dmitry Petrakoff <di...@dprs-consulting.com> wrote: > Hi List! > > I'm running Kamailio for about 1 year without any serious problems. > When it works with UDP only, it runs perfectly well for us. Without any > major issues. > > But now we have a customer who wants to connect Lync to our network. > Unfortunately, Lync does not support UDP for SIP signalling, so we tried > to teach kamailio to send SIP messages via TCP. > And getting strange error: > [...] > 10(36629) ERROR: <core> [tcp_main.c:2754]: 10.198.3.100:5060: connect & > send for 0x28d988ac failed: Socket is not connected (57) > 10(36629) DEBUG: <core> [tcp_main.c:2955]: tcpconn_chld_put: destroying > connection 0x28d988ac (1, -1) flags 0060 > 10(36629) ERROR: tm [../../forward.h:170]: msg_send: ERROR: tcp_send failed
Could you try the attached patch and report back if it works? (I couldn't reproduce it on my ancient FreeBSD 7.1) I think the problem is that newer FreeBSD versions return ENOTCONN when attempting to send on a not yet fully connected socket (instead of EAGAIN). Andrei [...]
>From aa073d37a1433cad617a5f93c28a0a7c7d2ca702 Mon Sep 17 00:00:00 2001 From: Andrei Pelinescu-Onciul <and...@iptel.org> Date: Tue, 22 Nov 2011 12:55:39 +0100 Subject: [PATCH] tcp: fix for ENOTCONN on newer FreeBSDs Newer FreeBSDs return ENOTCONN instead of EAGAIN/EWOULDBLOCK when trying to send on a non-blocking socket which is not yet fully connected (the connect is still pending). Reported-by: Dmitry Petrakoff dimon dprs-consulting com --- tcp_main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/tcp_main.c b/tcp_main.c index 5aa8638..b1635ff 100644 --- a/tcp_main.c +++ b/tcp_main.c @@ -2693,7 +2693,10 @@ static int tcpconn_1st_send(int fd, struct tcp_connection* c, n=_tcpconn_write_nb(fd, c, buf, len); if (unlikely(n<(int)len)){ - if ((n>=0) || errno==EAGAIN || errno==EWOULDBLOCK){ + /* on EAGAIN or ENOTCONN return success. + ENOTCONN appears on newer FreeBSD versions (non-blocking socket, + connect() & send immediately) */ + if ((n>=0) || errno==EAGAIN || errno==EWOULDBLOCK || errno==ENOTCONN){ DBG("pending write on new connection %p " " (%d/%d bytes written)\n", c, n, len); if (unlikely(n<0)) n=0; -- 1.7.2.1
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users