提交 ad36f2a9 authored 作者: Michael Jerris's avatar Michael Jerris

update to latest darcs sofia

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3888 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 af598aa0
......@@ -5,17 +5,30 @@ Pekka Pessi <pekka.pessi -at nokia -dot com>
Martti Mela <martti.mela -at nokia -dot com>
Kai Vehmanen <kai.vehmanen -at nokia -dot com>
Contributors (in alphabetical order)
------------------------------------
Contributors (in alphabetical order, surname first)
---------------------------------------------------
Chan, Tat
Haataja, Mikko
Jacobs, Remeres
Jalava, Teemu
Chan, Tat <first.surname@nokia.com>
Ciarkowski, Andrzej <wp-voigtkampff -at users -dot sourceforge -dot net>
Haataja, Mikko <first.surname@nokia.com>
Jacobs, Remeres <first.surname@nokia.com>
Jalava, Teemu <first.surname@nokia.com>
Jerris, Michael <mike -at jerris -dot com>
Legostayev Denis <legostayev -at neic -dot nsk -dot su>
Prado, Dimitri E. <dprado -at e3c -dot com -dot br>
Puustinen, Ismo
Rinne-Rahkola, Pasi
Saari, Mika
Selin, Jari
Urpalainen, Jari
Puolakka, Petteri <first.surname@nokia.com>
Puustinen, Ismo <first.surname@nokia.com>
Rinne-Rahkola, Pasi <first.surname@nokia.com>
Saari, Mika <first.surname@nokia.com>
Selin, Jari <first.surname@nokia.com>
Underwood, Steve <steveu -at coppice -dot org>
Urpalainen, Jari <first.surname@nokia.com>
Whittaker, Colin <colinw -at occamnetworks -dot com>
Zabaluev, Mikhail <first.surname@nokia.com>
Note: for details on who did what, see the version control
system change history, and release notes for past releases at
http://sofia-sip.sourceforge.net/relnotes/
\ No newline at end of file
......@@ -55,6 +55,7 @@ Contributors to this release
- **template**: First Surname (patch to nua/soa/msg)
- Petteri Puolakka (patch to stun)
- Mikhail Zabluev (patch to su-glib mainloop integration)
See the AUTHORS file in the distribution package.
......@@ -94,3 +95,8 @@ Bugs fixed in this release
Roman Filonenko.
- Bug in zero-padding STUN messages with a message integrity
attribute. Patch by Petteri Puolakka.
- Fixed a severe problem with timer accuracy, when sofia-sip timers
where used under glib's mainloop.
- Improved glib mainloop integration to avoid warnings about already
active mainloop context, and potentially other issue. Patch by
Mikhail Zabaluev. Closes sf.net item #1606786.
#! /bin/sh
./configure $@ --with-pic --with-glib=no
......@@ -19,12 +19,12 @@ INCLUDES = -I$(S_BASE)/su -I$(B_BASE)/su $(GLIB_CFLAGS)
noinst_LTLIBRARIES = libsu-glib.la
check_PROGRAMS = su_source_test
check_PROGRAMS = su_source_test torture_su_glib_timer
# ----------------------------------------------------------------------
# Tests
TESTS = su_source_test
TESTS = su_source_test torture_su_glib_timer
# ----------------------------------------------------------------------
# Rules for building the targets
......
......@@ -319,34 +319,28 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
enter;
if (self->sup_head)
if (self->sup_head) {
*return_tout = 0;
return TRUE;
*return_tout = -1;
}
if (self->sup_timers) {
su_time_t now;
GTimeVal gtimeval;
su_duration_t tout;
tout = SU_DURATION_MAX;
g_source_get_current_time(gs, &gtimeval);
now.tv_sec = gtimeval.tv_sec + 2208988800UL;
now.tv_usec = gtimeval.tv_usec;
tout = su_timer_next_expires(self->sup_timers, now);
if (tout == 0)
return TRUE;
if ((gint)tout < 0 || tout > (su_duration_t)G_MAXINT)
tout = -1;
*return_tout = (tout < 0 || tout > (su_duration_t)G_MAXINT)?
-1 : (gint)tout;
*return_tout = (gint)tout;
return (tout == 0);
}
return FALSE;
}
......@@ -995,30 +989,30 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout)
gmc = g_source_get_context(self->sup_source);
if (gmc && g_main_context_acquire(gmc)) {
GPollFD *fds = NULL;
gint fds_size = 0;
gint fds_wait;
gint priority = G_MAXINT;
if (g_main_context_prepare(gmc, &priority)) {
g_main_context_dispatch(gmc);
} else {
gint timeout = tout > G_MAXINT ? G_MAXINT : tout;
gint i, n = 0;
GPollFD *fds = NULL;
priority = G_MAXINT;
n = g_main_context_query(gmc, priority, &timeout, fds, n);
if (n > 0) {
fds = g_alloca(n * (sizeof *fds));
n = g_main_context_query(gmc, priority, &timeout, fds, n);
}
gint src_tout = -1;
if (tout < timeout)
timeout = tout;
g_main_context_prepare(gmc, &priority);
i = su_wait((su_wait_t *)fds, n, timeout);
if (g_main_context_check(gmc, priority, fds, n))
g_main_context_dispatch(gmc);
fds_wait = g_main_context_query(gmc, priority, &src_tout, NULL, 0);
while (fds_wait > fds_size) {
fds = g_alloca(fds_wait * sizeof(fds[0]));
fds_size = fds_wait;
fds_wait = g_main_context_query(gmc, priority, &src_tout, fds, fds_size);
}
if (src_tout >= 0 && tout > (su_duration_t)src_tout)
tout = src_tout;
su_wait((su_wait_t *)fds, fds_wait, tout);
g_main_context_check(gmc, priority, fds, fds_wait);
g_main_context_dispatch(gmc);
g_main_context_release(gmc);
}
......
......@@ -90,7 +90,7 @@ doxygen: built-sources
for d in $(DIST_SUBDIRS); do \
test -r $$d/Doxyfile \
&& pushd $$d > /dev/null \
&& echo running ${DOXYGEN} in second time in $$d \
&& echo running ${DOXYGEN} second time in $$d \
&& ${DOXYGEN} 2>&1 \
| egrep -v -i -e 'Warning: Unsupported (xml/)?html tag' \
; popd > /dev/null ; \
......
......@@ -3074,13 +3074,6 @@ int nta_msg_request_complete(msg_t *msg,
if (!sip->sip_max_forwards)
sip_add_dup(msg, sip, (sip_header_t *)leg->leg_agent->sa_max_forwards);
if (!sip->sip_call_id) {
if (leg->leg_id)
sip->sip_call_id = sip_call_id_dup(home, leg->leg_id);
else
sip->sip_call_id = sip_call_id_create(home, NULL);
}
if (!sip->sip_from)
sip->sip_from = sip_from_dup(home, leg->leg_local);
else if (leg->leg_local && leg->leg_local->a_tag &&
......@@ -3113,7 +3106,10 @@ int nta_msg_request_complete(msg_t *msg,
method = sip->sip_request->rq_method;
method_name = sip->sip_request->rq_method_name;
if (method == sip_method_ack || method == sip_method_cancel)
if (!leg->leg_id && !sip->sip_call_id && sip->sip_cseq)
seq = sip->sip_cseq->cs_seq;
else if (method == sip_method_ack || method == sip_method_cancel)
/* Dangerous - we may do PRACK/UPDATE meanwhile */
seq = sip->sip_cseq ? sip->sip_cseq->cs_seq : leg->leg_seq;
else if (leg->leg_seq)
seq = ++leg->leg_seq;
......@@ -3122,6 +3118,13 @@ int nta_msg_request_complete(msg_t *msg,
else
seq = leg->leg_seq = (sip_now() >> 1) & 0x7ffffff;
if (!sip->sip_call_id) {
if (leg->leg_id)
sip->sip_call_id = sip_call_id_dup(home, leg->leg_id);
else
sip->sip_call_id = sip_call_id_create(home, NULL);
}
if ((!sip->sip_cseq ||
seq != sip->sip_cseq->cs_seq ||
method != sip->sip_cseq->cs_method ||
......@@ -9718,6 +9721,9 @@ int outgoing_recv_reliable(nta_outgoing_t *orq,
* @param magic
* @param to_tag
* @param rseq
*
* @bug Fix the memory leak - either one of the requests is left unreleased
* for ever.
*/
nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
nta_response_f *callback,
......@@ -9757,8 +9763,8 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
tagged->orq_to = to;
tagged->orq_tport = tport_ref(orq->orq_tport);
tagged->orq_request = (msg_t *)msg_ref_create(orq->orq_request);
tagged->orq_response = NULL;
tagged->orq_request = msg_ref_create(orq->orq_request);
tagged->orq_response = msg_ref_create(orq->orq_response);
tagged->orq_cancel = NULL;
tagged->orq_pending = tport_pend(orq->orq_tport,
......
......@@ -138,7 +138,7 @@ void sl_from_log(su_log_t *log, int level,
a->a_params = NULL;
if (!a->a_display) a->a_display = "";
return sl_header_log(log, level, fmt, (sip_header_t *)a);
sl_header_log(log, level, fmt, (sip_header_t *)a);
}
/**Log a @To header.
......
......@@ -17,7 +17,7 @@ INCLUDES = -I$(srcdir)/../bnf -I../bnf \
noinst_LTLIBRARIES = libsip.la
check_PROGRAMS = torture_sip \
test_sip_msg validator date_test
test_sip_msg validator test_date
# ----------------------------------------------------------------------
# Rules for building the targets
......@@ -59,7 +59,7 @@ LDADD = libsip.la \
torture_sip_LDFLAGS = -static
test_sip_msg_LDFLAGS = -static
date_test_LDFLAGS = -static
test_date_LDFLAGS = -static
# ----------------------------------------------------------------------
# Install and distribution rules
......@@ -93,9 +93,9 @@ EXTRA_DIST = Doxyfile sip.docs sip_parser.docs sip.doxyaliases \
# ----------------------------------------------------------------------
# Tests
#TESTS = torture_sip run_test_sip_msg run_date_test
#TESTS = torture_sip run_test_sip_msg run_test_date
#dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
#dist_noinst_SCRIPTS = run_test_sip_msg run_test_date
# ----------------------------------------------------------------------
# Sofia specific rules
......
#!/bin/sh
./date_test "Sun, 18 Mar 2001 23:01:00 GMT"
......@@ -24,7 +24,7 @@
/**@internal
*
* @CFILE date_test.c
* @CFILE test_date.c
*
* Tester for SIP date parser
*
......@@ -45,7 +45,7 @@
void usage(void)
{
fprintf(stderr,
"usage: date_test [SIP-date] "
"usage: test_date [SIP-date] "
"[YYYYy][DDd][HHh][MMm][SS[s]]\n");
exit(1);
}
......@@ -65,7 +65,7 @@ int main(int ac, char *av[])
if ((s = av[1])) {
if (msg_date_d(&s, &t) < 0) {
fprintf(stderr, "date_test: %s is not valid time\n", s);
fprintf(stderr, "test_date: %s is not valid time\n", s);
exit(1);
}
......@@ -82,7 +82,7 @@ int main(int ac, char *av[])
case '\0': --s; /* FALLTHROUGH */
case 's': delta += t2; break;
default:
fprintf(stderr, "date_test: %s is not valid time offset\n" , av[2]);
fprintf(stderr, "test_date: %s is not valid time offset\n" , av[2]);
usage();
break;
}
......@@ -100,12 +100,12 @@ int main(int ac, char *av[])
s = buf, t2 = 0;
if (msg_date_d(&s, &t2) < 0) {
fprintf(stderr, "date_test: decoding %s failed\n", buf);
fprintf(stderr, "test_date: decoding %s failed\n", buf);
retval = 1;
break;
}
else if (t2 != t) {
fprintf(stderr, "date_test: %lu != %lu\n", t, t2);
fprintf(stderr, "test_date: %lu != %lu\n", t, t2);
retval = 1;
break;
}
......
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS) $(SOFIA_COVERAGE)
# Use with --enable-ndebug
if NDEBUG
AM_CFLAGS += -DNDEBUG
endif
built-sources: $(BUILT_SOURCES)
......
......@@ -58,6 +58,10 @@
#include <sofia-sip/su_tag_inline.h>
#include <sofia-sip/su_tagarg.h>
#ifndef HAVE_STRTOULL
unsigned longlong strtoull(const char *, char **, int);
#endif
/**@defgroup su_tag Tag Item Lists
*
* Object-oriented tag routines for Sofia utility library.
......
......@@ -165,17 +165,16 @@ int su_time_print(char *s, int n, su_time_t const *tv)
/** Time difference in milliseconds.
*
* Calculates the duration from t2 to t1 in milliseconds.
* Calculates the duration from t2 to t1 in milliseconds.
*
* @param t1 after time
* @param t2 before time
*
* @return
* The duration in milliseconds between the two times. If the difference
* is bigger than @c SU_DURATION_MAX, the function su_duration() returns
* @c SU_DURATION_MAX instead. If the difference is smaller than @c
* -SU_DURATION_MAX, the function su_duration() returns @c
* -SU_DURATION_MAX.
* @return The duration in milliseconds between the two times.
* If the difference is bigger than #SU_DURATION_MAX, return #SU_DURATION_MAX
* instead.
* If the difference is smaller than -#SU_DURATION_MAX, return
* -#SU_DURATION_MAX.
*/
su_duration_t su_duration(su_time_t const t1, su_time_t const t2)
{
......
......@@ -7,7 +7,10 @@ INPUT = tport.docs sofia-sip .
TAGFILES += \
../docs/su.doxytags=../su \
../docs/msg.doxytags=../msg
../docs/msg.doxytags=../msg \
../docs/nth.doxytags=../nth \
../docs/nta.doxytags=../nta \
../docs/nua.doxytags=../nua \
GENERATE_TAGFILE = ../docs/tport.doxytags
......
......@@ -286,7 +286,7 @@ static inline int tport_is_bound(tport_t const *self)
}
/** Test if transport connection has been established. @NEW_1_12_5 */
inline int tport_is_connected(tport_t const *self)
int tport_is_connected(tport_t const *self)
{
return self->tp_is_connected;
}
......@@ -308,7 +308,7 @@ void tport_set_tos(su_socket_t socket, su_addrinfo_t *ai, int tos)
{
if (tos >= 0 &&
ai->ai_family == AF_INET &&
setsockopt(socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
setsockopt(socket, IPPROTO_IP, IP_TOS, (const void*)&tos, sizeof(tos)) < 0) {
SU_DEBUG_3(("tport: setsockopt(IP_TOS): %s\n",
su_strerror(su_errno())));
}
......@@ -427,7 +427,12 @@ msg_t *tport_destroy_alloc(tp_stack_t *stack, int flags,
/** Name for "any" transport. @internal */
static char const tpn_any[] = "*";
/** Create the master transport. */
/** Create the master transport.
*
* @TAGS
* TPTAG_LOG(), TPTAG_DUMP(), tags used with tport_set_params(), especially
* TPTAG_QUEUESIZE().
*/
tport_t *tport_tcreate(tp_stack_t *stack,
tp_stack_class_t const *tpac,
su_root_t *root,
......@@ -1128,6 +1133,12 @@ int tport_get_params(tport_t const *self,
*
* @param self pointer to a transport object
* @param tag,value,... list of tags
*
* @TAGS
* TPTAG_MTU(), TPTAG_QUEUESIZE(), TPTAG_IDLE(), TPTAG_TIMEOUT(),
* TPTAG_DEBUG_DROP(), TPTAG_THRPSIZE(), TPTAG_THRPRQSIZE(),
* TPTAG_SIGCOMP_LIFETIME(), TPTAG_CONNECT(), TPTAG_SDWN_ERROR(),
* TPTAG_REUSE(), TPTAG_STUN_SERVER(), and TPTAG_TOS().
*/
int tport_set_params(tport_t *self,
tag_type_t tag, tag_value_t value, ...)
......@@ -1138,8 +1149,6 @@ int tport_set_params(tport_t *self,
int connect, sdwn_error, reusable, stun_server;
struct sigcomp_compartment *cc = NONE;
if (self == NULL)
return su_seterrno(EINVAL);
......@@ -1164,7 +1173,6 @@ int tport_set_params(tport_t *self,
TPTAG_CONNECT_REF(connect),
TPTAG_SDWN_ERROR_REF(sdwn_error),
TPTAG_REUSE_REF(reusable),
TPTAG_COMPARTMENT_REF(cc),
TPTAG_STUN_SERVER_REF(stun_server),
TPTAG_TOS_REF(tpp->tpp_tos),
TAG_END());
......@@ -1324,6 +1332,11 @@ int tport_bind_set(tport_master_t *mr,
* @param tpn desired transport address
* @param transports list of protocol names supported by stack
* @param tag,value,... tagged argument list
*
* @TAGS
* TPTAG_SERVER(), TPTAG_PUBLIC(), TPTAG_IDENT(), TPTAG_HTTP_CONNECT(),
* TPTAG_CERTIFICATE(), TPTAG_TLS_VERSION(), and tags used with
* tport_set_params(), especially TPTAG_QUEUESIZE().
*/
int tport_tbind(tport_t *self,
tp_name_t const *tpn,
......@@ -2940,6 +2953,7 @@ int tport_recv_error_report(tport_t *self)
*
* @TAGS
* TPTAG_MTU(), TPTAG_REUSE(), TPTAG_CLOSE_AFTER(), TPTAG_SDWN_AFTER(),
* TPTAG_FRESH(), TPTAG_COMPARTMENT().
*/
tport_t *tport_tsend(tport_t *self,
msg_t *msg,
......@@ -4526,5 +4540,3 @@ char *tport_hostport(char buf[], isize_t bufsize,
return buf;
}
/* ---------------------------------------------------------------------- */
......@@ -90,14 +90,24 @@ su_log_t tport_log[] = {
/** Initialize logging. */
void tport_open_log(tport_master_t *mr, tagi_t *tags)
{
char const *log;
mr->mr_log =
getenv("MSG_STREAM_LOG") != NULL ||
getenv("TPORT_LOG") != NULL
? MSG_DO_EXTRACT_COPY : 0;
if ((log = getenv("TPORT_DUMP")) || (log = getenv("MSG_DUMP"))) {
char const *log = NULL;
int log_msg = 0;
tl_gets(tags, TPTAG_LOG_REF(log_msg), TAG_END());
if (getenv("MSG_STREAM_LOG") != NULL || getenv("TPORT_LOG") != NULL)
log_msg = 1;
mr->mr_log = log_msg ? MSG_DO_EXTRACT_COPY : 0;
tl_gets(tags, TPTAG_DUMP_REF(log), TAG_END());
if (getenv("MSG_DUMP"))
log = getenv("MSG_DUMP");
if (getenv("TPORT_DUMP"))
log = getenv("TPORT_DUMP");
if (log) {
time_t now;
if (strcmp(log, "-"))
......
......@@ -78,3 +78,6 @@ tag_typedef_t tptag_thrprqsize = UINTTAG_TYPEDEF(thrprqsize);
tag_typedef_t tptag_http_connect = STRTAG_TYPEDEF(http_connect);
tag_typedef_t tptag_stun_server = BOOLTAG_TYPEDEF(stun_server);
tag_typedef_t tptag_tos = INTTAG_TYPEDEF(tos);
tag_typedef_t tptag_log = INTTAG_TYPEDEF(log);
tag_typedef_t tptag_dump = STRTAG_TYPEDEF(dump);
......@@ -54,7 +54,7 @@
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
#else
char const __func__[] = "tport_type_tcp";
static char const __func__[] = "tport_type_tcp";
#endif
/* ---------------------------------------------------------------------- */
......
......@@ -58,6 +58,13 @@ int tport_udp_init_client(tport_primary_t *pri,
tagi_t const *tags,
char const **return_culprit);
#if HAVE_FUNC
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
#else
static char const __func__[] = "tport_type_udp";
#endif
tport_vtable_t const tport_udp_client_vtable =
{
"udp", tport_type_client,
......@@ -215,7 +222,7 @@ static void tport_check_trunc(tport_t *tp, su_addrinfo_t *ai)
int tport_recv_dgram(tport_t *self)
{
msg_t *msg;
ssize_t n, veclen;
ssize_t n, veclen, N;
su_addrinfo_t *ai;
su_sockaddr_t *from;
socklen_t fromlen;
......@@ -232,8 +239,21 @@ int tport_recv_dgram(tport_t *self)
assert(self->tp_msg == NULL);
veclen = tport_recv_iovec(self, &self->tp_msg, iovec, 65536, 1);
if (veclen < 0)
#if nomore
/* We used to resize the buffer, but it fragments the memory */
N = 65535;
#else
N = (ssize_t)su_getmsgsize(self->tp_socket);
if (N == -1) {
int err = su_errno();
SU_DEBUG_1(("%s(%p): su_getmsgsize(): %s (%d)\n", __func__, self,
su_strerror(err), err));
return -1;
}
#endif
veclen = tport_recv_iovec(self, &self->tp_msg, iovec, N, 1);
if (veclen == -1)
return -1;
msg = self->tp_msg;
......
......@@ -133,7 +133,7 @@ AC_ARG_ENABLE(coverage,
if test X$enable_coverage != Xno ; then
case "${CC-cc}" in
*gcc*)
SOFIA_CFLAGS="$SOFIA_CFLAGS -fprofile-arcs -ftest-coverage"
AC_SUBST([SOFIA_COVERAGE], ["-fprofile-arcs -ftest-coverage"])
;;
*) AC_MSG_ERROR([--enable-coverage requires gcc])
esac
......@@ -344,7 +344,6 @@ AC_ARG_ENABLE(ndebug,
[ --enable-ndebug compile with NDEBUG (disabled)],
, enable_ndebug=no)
AM_CONDITIONAL(NDEBUG, test x$enable_ndebug = yes)
SOFIA_CFLAGS="$SOFIA_CFLAGS -DNDEBUG"
])
dnl ======================================================================
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论