[Home]

Summary:ASTERISK-06593: two identical code blocks in chan_sip.c in function process_sdp
Reporter:Fabian Mueller (fmueller)Labels:
Date Opened:2006-03-22 00:57:32.000-0600Date Closed:2011-06-07 14:07:51
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:There are these two code blocks in process_sdp:

/* Check for Media-description-level-address for audio */
if (pedanticsipchecking) {
c = get_sdp_iterate(&destiterator, req, "c");
if (!ast_strlen_zero(c)) {
if (sscanf(c, "IN IP4 %256s", host) != 1) {
ast_log(LOG_WARNING, "Invalid secondary host in c= line, '%s'\n", c);
} else {
/* XXX This could block for a long time, and block the main thread! XXX */
hp = ast_gethostbyname(host, &ahp);
if (!hp) {
ast_log(LOG_WARNING, "Unable to lookup host in secondary c= line, '%s'\n", c);
}
}
}
}


And a few lines later there is this one:


/* Check for Media-description-level-address for video */
if (pedanticsipchecking) {
c = get_sdp_iterate(&destiterator, req, "c");
if (!ast_strlen_zero(c)) {
if (sscanf(c, "IN IP4 %256s", host) != 1) {
ast_log(LOG_WARNING, "Invalid secondary host in c= line, '%s'\n", c);
} else {
/* XXX This could block for a long time, and block the main thread! XXX */
hp = ast_gethostbyname(host, &ahp);
if (!hp) {
ast_log(LOG_WARNING, "Unable to lookup host in secondary c= line, '%s'\n", c);
}
}
}
}

I think the second code block is unnecessary, isn't it? If so it probably should be removed especially because of the comment "This could block for a long time, and block the main thread!"
Comments:By: nenadr (nenadr) 2006-03-22 03:14:10.000-0600

One is for audio hostname/IP address and second is for video! It may be one funcition called twice, but * shuld still check for two addresses.

By: Fabian Mueller (fmueller) 2006-03-22 03:33:33.000-0600

Ok, then it really should be one function called twice in my oppinion.

By: Olle Johansson (oej) 2006-03-22 07:43:43.000-0600

There are many blocks of code that needs to be cleaned up, however this is not a bug so I'm closing this. Patches are always welcome :-)

/O