[asterisk-commits] twilson: branch 1.6.2 r310997 - in /branches/1.6.2/main: manager.c tcptls.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 16 14:45:13 CDT 2011


Author: twilson
Date: Wed Mar 16 14:45:10 2011
New Revision: 310997

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310997
Log:
Revert patch with accidental reversion of a previous patch

Modified:
    branches/1.6.2/main/manager.c
    branches/1.6.2/main/tcptls.c

Modified: branches/1.6.2/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/manager.c?view=diff&rev=310997&r1=310996&r2=310997
==============================================================================
--- branches/1.6.2/main/manager.c (original)
+++ branches/1.6.2/main/manager.c Wed Mar 16 14:45:10 2011
@@ -228,6 +228,7 @@
 	struct mansession_session *session;
 	FILE *f;
 	int fd;
+	int write_error:1;
 };
 
 static AST_LIST_HEAD_STATIC(sessions, mansession_session);
@@ -964,11 +965,15 @@
  */
 static int send_string(struct mansession *s, char *string)
 {
-	if (s->f) {
-		return ast_careful_fwrite(s->f, s->fd, string, strlen(string), s->session->writetimeout);
-	} else {
-		return ast_careful_fwrite(s->session->f, s->session->fd, string, strlen(string), s->session->writetimeout);
-	}
+	int res;
+
+	if (s->f && (res = ast_careful_fwrite(s->f, s->fd, string, strlen(string), s->session->writetimeout))) {
+		s->write_error = 1;
+	} else if ((res = ast_careful_fwrite(s->session->f, s->session->fd, string, strlen(string), s->session->writetimeout))) {
+		s->write_error = 1;
+	}
+
+	return res;
 }
 
 /*!
@@ -3277,7 +3282,7 @@
 
 	astman_append(&s, "Asterisk Call Manager/%s\r\n", AMI_VERSION);	/* welcome prompt */
 	for (;;) {
-		if ((res = do_message(&s)) < 0)
+		if ((res = do_message(&s)) < 0 || s.write_error)
 			break;
 	}
 	/* session is over, explain why and terminate */

Modified: branches/1.6.2/main/tcptls.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/tcptls.c?view=diff&rev=310997&r1=310996&r2=310997
==============================================================================
--- branches/1.6.2/main/tcptls.c (original)
+++ branches/1.6.2/main/tcptls.c Wed Mar 16 14:45:10 2011
@@ -139,12 +139,8 @@
 	* open a FILE * as appropriate.
 	*/
 	if (!tcptls_session->parent->tls_cfg) {
-		if ((tcptls_session->f = fdopen(tcptls_session->fd, "w+"))) {
-			if(setvbuf(tcptls_session->f, NULL, _IONBF, 0)) {
-				fclose(tcptls_session->f);
-				tcptls_session->f = NULL;
-			}
-		}
+		tcptls_session->f = fdopen(tcptls_session->fd, "w+");
+		setvbuf(tcptls_session->f, NULL, _IONBF, 0);
 	}
 #ifdef DO_SSL
 	else if ( (tcptls_session->ssl = SSL_new(tcptls_session->parent->tls_cfg->ssl_ctx)) ) {




More information about the asterisk-commits mailing list