[asterisk-addons-commits] mnicholson: branch mnicholson/chan-mobile-refactor r772 - /team/mnicholson/ch...

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Wed Feb 11 11:45:37 CST 2009


Author: mnicholson
Date: Wed Feb 11 11:45:36 2009
New Revision: 772

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=772
Log:
simplify do_monitor_headset() loop by removing monitor variable

Modified:
    team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c

Modified: team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c?view=diff&rev=772&r1=771&r2=772
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Wed Feb 11 11:45:36 2009
@@ -2613,14 +2613,13 @@
 {
 
 	struct mbl_pvt *pvt = (struct mbl_pvt *)data;
-	char monitor = 1;
 	char buf[256];
 	int t;
 	at_message_t at_msg;
 
 	pvt->state = MBL_STATE_PREIDLE;
 
-	while (monitor) {
+	for (;;) {
 
 		if (pvt->state == MBL_STATE_RING2)
 			t = 2000;
@@ -2634,8 +2633,7 @@
 				else
 					ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, buf, errno); 
 
-				monitor = 0;
-				continue;
+				break;
 			}
 			ast_debug(1, "[%s] %s\n", pvt->id, buf);
 
@@ -2646,7 +2644,7 @@
 					pvt->state = MBL_STATE_INCOMING;
 					if (hsp_send_vgs(pvt->rfcomm_socket, 13) || hsp_send_vgm(pvt->rfcomm_socket, 13)) {
 						ast_debug(1, "[%s] error sending VGS/VGM\n", pvt->id); 
-						monitor = 0;
+						break;
 					}
 				}
 				break;
@@ -2666,7 +2664,7 @@
 			} else if (at_msg == AT_UNKNOWN) {
 				if (hsp_send_error(pvt->rfcomm_socket)) {
 					ast_debug(1, "[%s] error sending ERROR\n", pvt->id); 
-					monitor = 0;
+					break;
 				}
 			}
 		} else {	/* Timeouts */
@@ -2686,7 +2684,7 @@
 			} else if (pvt->state == MBL_STATE_RING2) {
 				if (hsp_send_ring(pvt->rfcomm_socket)) {
 					ast_debug(1, "[%s] error sending RING\n", pvt->id); 
-					monitor = 0;
+					break;
 				}
 			}
 		}




More information about the asterisk-addons-commits mailing list