From 297f3dc0f820b1820580ce22c2efc5b4ab57fb38 Mon Sep 17 00:00:00 2001 From: darkeye Date: Sun, 16 Jul 2006 16:24:46 +0000 Subject: [PATCH] moved shoutcast server response checking right after passing password to the server. this should solve connection issues for recent shoutcast servers --- darkice/trunk/src/ShoutCast.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/darkice/trunk/src/ShoutCast.cpp b/darkice/trunk/src/ShoutCast.cpp index d10ac0a..9737300 100644 --- a/darkice/trunk/src/ShoutCast.cpp +++ b/darkice/trunk/src/ShoutCast.cpp @@ -140,6 +140,20 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) sink->write( str, strlen( str)); sink->flush(); + /* read the anticipated response: "OK" */ + len = source->read( resp, STRBUF_SIZE); + reportEvent(8, "server response length: ", len); + reportEvent(8, "server response: ", resp); + if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { + return false; + } + + /* suck anything that the other side has to say */ + while ( source->canRead( 0, 0) && + (len = source->read( resp, STRBUF_SIZE)) ) { + ; + } + /* send the icy headers */ if ( getName() ) { str = "icy-name:"; @@ -201,18 +215,6 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) sink->write( str, strlen( str)); sink->flush(); - /* read the anticipated response: "OK" */ - len = source->read( resp, STRBUF_SIZE); - if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { - return false; - } - - /* suck anything that the other side has to say */ - while ( source->canRead( 0, 0) && - (len = source->read( resp, STRBUF_SIZE)) ) { - ; - } - return true; } @@ -223,6 +225,11 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.4 2006/07/16 16:24:46 darkeye + moved shoutcast server response checking right after passing password + to the server. this should solve connection issues for recent + shoutcast servers + Revision 1.3 2002/05/28 12:35:41 darkeye code cleanup: compiles under gcc-c++ 3.1, using -pedantic option