VOID socketDestroy(int iSock) { ULONG ulIdx = 0; if ( xplMutexLock( hmtxSockets, XPL_INDEFINITE_WAIT ) != XPL_NO_ERROR ) { debug( "xplMutexLock() failed" ); return; } while( ulIdx < cSockets ) { if ( aSockets[ulIdx].aiSocket == iSock ) { cSockets--; aSockets[ulIdx] = aSockets[cSockets]; #ifdef DEBUG_FILE debugDec( "sockets" ); // ulIdx = ~0; #endif break; } ulIdx++; } xplMutexUnlock( hmtxSockets ); xplSockClose( iSock ); /*#ifdef DEBUG_FILE if ( ulIdx != ~0 ) debug( "Socket %d not found", iSock ); #endif*/ }
void traceLeave(const char * szFunction,const char * szFormat,...) { debugDec(); debugIndent (); fprintf(stderr,"[<< %s][at %lu] ",szFunction,getInputLineNumber()); va_list va; va_start(va,szFormat); vfprintf(stderr,szFormat,va); va_end(va); fprintf(stderr,"\n"); }