[rtmpdump] [PATCH 2/2] Don't try to close an already closed socket

Martin Storsjo martin at martin.st
Fri Jul 15 12:46:03 CEST 2011


This could happen if WriteN() (called within SendBytesReceived())
failed.
---
 librtmp/rtmp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 064a934..1c0a5d5 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -3582,7 +3582,9 @@ RTMPSockBuf_Close(RTMPSockBuf *sb)
       sb->sb_ssl = NULL;
     }
 #endif
-  return closesocket(sb->sb_socket);
+  if (sb->sb_socket != -1)
+      return closesocket(sb->sb_socket);
+  return 0;
 }
 
 #define HEX2BIN(a)	(((a)&0x40)?((a)&0xf)+9:((a)&0xf))
-- 
1.7.3.1



More information about the rtmpdump mailing list