[Asterisk-code-review] res rtp: Fix regression observed in FreeBSD when IPv6 is not... (asterisk[master])
Richard Mudgett
asteriskteam at digium.com
Tue Nov 22 21:56:23 CST 2016
Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/4487 )
Change subject: res_rtp: Fix regression observed in FreeBSD when IPv6 is not available
......................................................................
Patch Set 1: Code-Review-1
(7 comments)
Looks ok other than the formatting issues.
https://gerrit.asterisk.org/#/c/4487/1//COMMIT_MSG
Commit Message:
Line 9: As reported in ASTERISK-26617 the latest Release candidate fails
Please use the commit message format described by:
https://wiki.asterisk.org/wiki/display/AST/Commit+Messages
https://gerrit.asterisk.org/#/c/4487/1/main/udptl.c
File main/udptl.c:
Line 1042: if(udptl->fd < 0) {
Guidelines: space after if
if () {
}
Line 1046: if(udptl->fd < 0) {
Guidelines: space after if
if () {
}
PS1, Line 1040: #if defined(__FreeBSD__)
: udptl->fd = socket(AF_INET6, SOCK_DGRAM, 0);
: if(udptl->fd < 0) {
: ast_sockaddr_parse(addr, "0.0.0.0", 0);
: udptl->fd = socket(AF_INET, SOCK_DGRAM, 0);
: }
: if(udptl->fd < 0) {
: #else
: if ((udptl->fd = socket(ast_sockaddr_is_ipv6(addr) ?
: AF_INET6 : AF_INET, SOCK_DGRAM, 0)) < 0) {
: #endif
: ast_free(udptl);
: ast_log(LOG_WARNING, "Unable to allocate socket: %s\n", strerror(errno));
: return NULL;
: }
The opening curly brace for these if statements are unbalanced and code folding editors become confused.
Rework to remove the assignment in the original if statement like this:
#if defined(__FreeBSD__)
udptl->fd = socket(..);
if (udptl->fd < 0) {
...
}
#else
udptl->fd = socket(ast_sockaddr_is_ipvx(addr)) ? ...);
#endif
if (udptl->fd < 0) {
ast_free(udptl);
...
}
https://gerrit.asterisk.org/#/c/4487/1/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:
Line 2661: if(rtp->s < 0) {
Guidelines: space after if
if () {
}
Line 2666: if(rtp->s < 0) {
Guidelines: space after if
if () {
}
PS1, Line 2659: #if defined(__FreeBSD__)
: rtp->s = create_new_socket("RTP", AF_INET6);
: if(rtp->s < 0) {
: /* create correct addr structure for AF_INET */
: ast_sockaddr_parse(addr, "0.0.0.0", 0);
: rtp->s = create_new_socket("RTP", AF_INET);
: }
: if(rtp->s < 0) {
: #else
: if ((rtp->s =
: create_new_socket("RTP",
: ast_sockaddr_is_ipv4(addr) ? AF_INET :
: ast_sockaddr_is_ipv6(addr) ? AF_INET6 : -1)) < 0) {
: #endif
The opening curly brace for these if statements are unbalanced and code folding editors become confused.
Rework to remove the assignment in the original if statement like this:
#if defined(__FreeBSD__)
rtp->s = create_new_socket(..);
if (rtp->s < 0) {
...
}
#else
rtp->s = create_new_socket("RTP", xxx ? ...);
#endif
if (rtp->s < 0) {
ast_free(rtp);
...
}
--
To view, visit https://gerrit.asterisk.org/4487
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I627a4e91795e821111e1cda523f083a40d0e0c3e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Guido Falsi <madpilot at freebsd.org>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list