fix qa bug of not resetting s_i.

fix tcpserver.cpp bug of destroying a streaming
socket after what is really not the final write.
This commit is contained in:
Matt 2015-02-17 20:10:13 -07:00
parent d14cb2d5b0
commit dce8d9f930
2 changed files with 11 additions and 6 deletions

View File

@ -1942,11 +1942,12 @@ int32_t TcpServer::writeSocket ( TcpSocket *s ) {
s->m_sockState = ST_READING;
return 1 ;
}
else {
// close it. without this here the socket only gets
// closed for real in the timeout loop
destroySocket ( s );
}
if ( s->m_streamingMode ) return true;
// close it. without this here the socket only gets
// closed for real in the timeout loop
destroySocket ( s );
// . otherwise, we finished sending a reply
// . our caller should call recycleSocket ( s ) to keep it alive

6
qa.cpp
View File

@ -26,6 +26,7 @@ void wait( float seconds ) {
NULL , // state
qatestWrapper,//m_masterLoop
0 )) {// niceness
log("qa: waiting %i milliseconds",(int)delay);
s_registered = true;
// wait for it, return -1 since we blocked
return;
@ -1071,18 +1072,20 @@ bool qaSyntax ( ) {
return false;
}
static int s_i;
// now query check
//static bool s_y4 = false;
if ( ! s_flags[4] ) {
wait(1.5);
s_flags[4] = true;
s_i = 0;
return false;
}
//
// now run a bunch of queries
//
static int s_i = 0;
static char *s_q[] ={"cat dog",
"+cat",
"mp3 \"take five\"",
@ -2830,6 +2833,7 @@ bool qatest ( ) {
if ( s_registered ) {
g_loop.unregisterSleepCallback(NULL,qatestWrapper);
s_registered = false;
log("qa: done waiting");
}
if ( ! s_callback ) s_callback = qatest;