[sr-dev] receive buffer questions
Klaus Darilion
klaus.mailinglists at pernau.at
Thu Feb 21 08:05:12 CET 2013
Hi! I have 2 questions regarding the receive buffer:
1. Core parameter: tcp_clone_rcvbuf
> Control if the received buffer should be cloned from the TCP stream, needed by functions working inside the SIP message buffer (such as msg_apply_changes()).
>
> Default is 0 (don't clone), set it to 1 for cloning.
Does this mean that in the default setting msg_apply_changes() does not
work for messages received via TCP? If yes, we should add this
information to the documentation of msg_apply_changes().
2. in udp_server.c function udp_rcv_loop():
{
#ifdef DYN_BUF
char* buf;
#else
static char buf [BUF_SIZE+1];
#endif
...
#ifdef DYN_BUF
buf=pkg_malloc(BUF_SIZE+1);
if (buf==0){
LOG(L_ERR, "ERROR: udp_rcv_loop: could not
allocate receive"
" buffer\n");
goto error;
}
#endif
...
/* receive_msg must free buf too!*/
receive_msg(buf, len, &ri);
...
}
a) I think the /* receive_msg must free buf too!*/ comment is wrong as
receive_msg does not free the buffer. It does not even know if it is a
static buffer or allocated. -> remove the comment?
b) It seems that if DYN_BUF is defined, "buf" will not be freed at all.
regards
Klaus
More information about the sr-dev
mailing list