[xiph-commits] r8188 - icecast/trunk/libshout/src

brendan at motherfish-iii.xiph.org brendan at motherfish-iii.xiph.org
Wed Nov 10 12:00:45 PST 2004


Author: brendan
Date: 2004-11-10 12:00:44 -0800 (Wed, 10 Nov 2004)
New Revision: 8188

Modified:
   icecast/trunk/libshout/src/shout.c
Log:
Oops. Don't close unconnected links in shout_close. On the other hand, closing
connected links is probably even a good idea.

Clean up some state in case shout_t is reused.


Modified: icecast/trunk/libshout/src/shout.c
===================================================================
--- icecast/trunk/libshout/src/shout.c	2004-11-10 16:09:20 UTC (rev 8187)
+++ icecast/trunk/libshout/src/shout.c	2004-11-10 20:00:44 UTC (rev 8188)
@@ -42,7 +42,7 @@
 static int queue_data(shout_queue_t *queue, const unsigned char *data, size_t len);
 static int queue_str(shout_t *self, const char *str);
 static int queue_printf(shout_t *self, const char *fmt, ...);
-static void queue_free(shout_queue_t *queue);
+static inline void queue_free(shout_queue_t *queue);
 static int send_queue(shout_t *self);
 static int get_response(shout_t *self);
 static int try_connect (shout_t *self);
@@ -160,7 +160,7 @@
 	if (!self)
 		return SHOUTERR_INSANE;
 
-	if (self->state != SHOUT_STATE_UNCONNECTED)
+	if (self->state == SHOUT_STATE_UNCONNECTED)
 		return self->error = SHOUTERR_UNCONNECTED;
 
 	if (self->close)
@@ -168,6 +168,10 @@
 
 	sock_close(self->socket);
 	self->state = SHOUT_STATE_UNCONNECTED;
+	self->starttime = 0;
+	self->senttime = 0;
+	queue_free(&self->rqueue);
+	queue_free(&self->wqueue);
 
 	return self->error = SHOUTERR_SUCCESS;
 }



More information about the commits mailing list