From a4a3fef09c223cde327c84d81238760959848c05 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Sat, 19 Mar 2005 12:33:34 +0000 Subject: cleanup some debug code git-svn-id: https://svn.musicpd.org/mpd/trunk@3102 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/interface.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/interface.c b/src/interface.c index 9b8c09d32..464e1503d 100644 --- a/src/interface.c +++ b/src/interface.c @@ -524,9 +524,17 @@ void closeOldInterfaces() { int i; for(i=0;iinterface_timeout))) { - DEBUG("interface %i: timeout\n",i); - closeInterface(&(interfaces[i])); + if(interfaces[i].open) { + if(interfaces[i].expired) { + DEBUG("interface %i: expired\n",i); + closeInterface(&(interfaces[i])); + } + else if(time(NULL)-interfaces[i].lastTime > + interface_timeout) + { + DEBUG("interface %i: timeout\n",i); + closeInterface(&(interfaces[i])); + } } } } @@ -629,15 +637,11 @@ void printInterfaceOutBuffer(Interface * interface) { char * buffer; int ret; - DEBUG("enter print interface out buffer\n"); - if(!interface->open || interface->expired || !interface->outBuflen) { - DEBUG("nothing todo, leaving\n"); return; } if(interface->bufferList) { - DEBUG("we have a bufferList\n"); interface->outputBufferSize+=sizeof(ListNode); interface->outputBufferSize+=interface->outBuflen+1; if(interface->outputBufferSize> @@ -662,12 +666,9 @@ void printInterfaceOutBuffer(Interface * interface) { } } else { - DEBUG("no bufferList, just generic buffer\n"); - DEBUG("attempting to write\n"); if((ret = write(interface->fd,interface->outBuffer, interface->outBuflen))<0) { - DEBUG("write unsuccessful\n"); if(errno==EAGAIN || errno==EINTR) { buffer = malloc(interface->outBuflen+1); memcpy(buffer,interface->outBuffer, @@ -685,7 +686,6 @@ void printInterfaceOutBuffer(Interface * interface) { } } else if(retoutBuflen) { - DEBUG("returned less than outBufLen\n"); buffer = malloc(interface->outBuflen-ret+1); memcpy(buffer,interface->outBuffer+ret, interface->outBuflen-ret); @@ -702,10 +702,7 @@ void printInterfaceOutBuffer(Interface * interface) { (char *)interface->bufferList-> firstNode->data)+1; } - DEBUG("done writing\n"); } interface->outBuflen = 0; - - DEBUG("leaving print interface out buffer\n"); } -- cgit v1.2.3