Review Board 1.7.16


0019287: inverse / incorrect behavior for CLI / console logging of DTMF

Review Request #1244 - Created June 1, 2011 and submitted

Jonathan Rose
1.8
19287
Reviewers
asterisk-dev
dvossel, russell
Asterisk
ast_network_puts_mutable writes to a connected console client only if it's level was set to false.  This changes that function to write it only if it is set to true to resolve the reverse behavior from expectations issue.

This seems like the way to go, but I can't see for the life of me why this mistake would be made if it really was just a mistake.  It's hard to say.
Just tested with a couple of connected clients.  I'll test more tomorrow.

Changes between revision 1 and 2

1 2 3 4
1 2 3 4

  1. /branches/1.8/main/asterisk.c: Loading...
/branches/1.8/main/asterisk.c
Diff Revision 1 Diff Revision 2
[20] 1084 lines
[+20] [+] int ast_safe_system(const char *s)
1085
void ast_console_toggle_loglevel(int fd, int level, int state)
1085
void ast_console_toggle_loglevel(int fd, int level, int state)
1086
{
1086
{
1087
	int x;
1087
	int x;
1088
	for (x = 0;x < AST_MAX_CONNECTS; x++) {
1088
	for (x = 0;x < AST_MAX_CONNECTS; x++) {
1089
		if (fd == consoles[x].fd) {
1089
		if (fd == consoles[x].fd) {
1090
			consoles[x].levels[level] = state;
1090
			consoles[x].levels[level] = (state + 1) % 2;
1091
			return;
1091
			return;
1092
		}
1092
		}
1093
	}
1093
	}
1094
}
1094
}
1095

    
   
1095

   
[+20] [20] 27 lines
[+20] [+] static void ast_network_puts_mutable(const char *string, int level)
1123
	int x;
1123
	int x;
1124
	for (x = 0;x < AST_MAX_CONNECTS; x++) {
1124
	for (x = 0;x < AST_MAX_CONNECTS; x++) {
1125
		if (consoles[x].mute)
1125
		if (consoles[x].mute)
1126
			continue;
1126
			continue;
1127
		if (consoles[x].fd > -1) {
1127
		if (consoles[x].fd > -1) {
1128
			if (consoles[x].levels[level])
1128
			if (!consoles[x].levels[level]) 
1129
				fdprint(consoles[x].p[1], string);
1129
				fdprint(consoles[x].p[1], string);
1130
		}
1130
		}
1131
	}
1131
	}
1132
}
1132
}
1133

    
   
1133

   
[+20] [20] 2754 lines
  1. /branches/1.8/main/asterisk.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.