From ea557db2c515633fa7d6d99e171992a6710e2b98 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 18 Apr 2007 21:28:09 +0000 Subject: [PATCH] Optimized search for data/hubid.qwk through q99 using glob(). --- src/sbbs3/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 610932bc7b..0692364e8c 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -2201,11 +2201,11 @@ void event_thread(void* arg) if(check_semaphores) { // See if any packets have come in - for(j=0;j<101;j++) { - SAFEPRINTF4(str,"%s%s.q%c%c",sbbs->cfg.data_dir,sbbs->cfg.qhub[i]->id - ,j>10 ? ((j-1)/10)+'0' : 'w' - ,j ? ((j-1)%10)+'0' : 'k'); - if(fexistcase(str) && flength(str)>0) { /* silently ignore 0-byte QWK packets */ + SAFEPRINTF2(str,"%s%s.q??",sbbs->cfg.data_dir,sbbs->cfg.qhub[i]->id); + glob(str,GLOB_NOSORT,NULL,&g); + for(i=0;i<(int)g.gl_pathc;i++) { + SAFECOPY(str,g.gl_pathv[i]); + if(flength(str)>0) { /* silently ignore 0-byte QWK packets */ eprintf(LOG_DEBUG,"Inbound QWK Packet detected: %s", str); delfiles(sbbs->cfg.temp_dir,ALLFILES); sbbs->online=ON_LOCAL; @@ -2225,6 +2225,7 @@ void event_thread(void* arg) remove(str); } } + globfree(&g); } /* Qnet call out based on time */ -- GitLab