From 156776797a854539bdcc368b6642bc3044425209 Mon Sep 17 00:00:00 2001
From: Mathieu Rene <mrene@avgs.ca>
Date: Wed, 31 Aug 2011 15:38:05 +0200
Subject: [PATCH] mod_rtmp: don't add data to the sendq if the connection's
 gone

---
 src/mod/endpoints/mod_rtmp/rtmp_tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mod/endpoints/mod_rtmp/rtmp_tcp.c b/src/mod/endpoints/mod_rtmp/rtmp_tcp.c
index b09cef7ad1..62bb709b01 100644
--- a/src/mod/endpoints/mod_rtmp/rtmp_tcp.c
+++ b/src/mod/endpoints/mod_rtmp/rtmp_tcp.c
@@ -143,7 +143,7 @@ static switch_status_t rtmp_tcp_write(rtmp_session_t *rsession, const unsigned c
 	
 	status = switch_socket_send_nonblock(io_pvt->socket, (char*)buf, len);
 	
-	if (*len < orig_len) {
+	if (*len > 0 && *len < orig_len) {
 		
 		if (rsession->state >= RS_DESTROY) {
 			return SWITCH_STATUS_FALSE;