DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Mon, 2017-07-24, 15:35

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed, 2013-01-02, 17:53 
Offline

Joined: Thu, 2007-06-28, 20:48
Posts: 29
Hi,

I've checked out latest git branch. If I run findscu and it can't connect to the PACS, the process exits with status 0. I'd like it to exit with 1 indicating there was an error. I would like to submit a simple patch (I hope the diff format is correct, I'm not that good with git):

Code:
diff --git dcmnet/apps/findscu.cc dcmnet/apps/findscu.cc
index a17220f..60fca13 100644
--- dcmnet/apps/findscu.cc
+++ dcmnet/apps/findscu.cc
@@ -627,10 +627,15 @@ int main(int argc, char *argv[])
       NULL, /* we want to use the default callback */
       &fileNameList,
       opt_outputDirectory.c_str());
-
+   if (cond.bad()) return 1;
+   
     // destroy network structure
     cond = findscu.dropNetwork();
-    if (cond.bad()) OFLOG_ERROR(findscuLogger, DimseCondition::dump(temp_str, cond));
+    if (cond.bad())
+   {
+      OFLOG_ERROR(findscuLogger, DimseCondition::dump(temp_str, cond));
+      return 1;
+   }
 
 #ifdef HAVE_WINSOCK_H
     WSACleanup();
@@ -644,9 +649,11 @@ int main(int argc, char *argv[])
         if (!tLayer->writeRandomSeed(opt_writeSeedFile))
         {
           OFLOG_ERROR(findscuLogger, "cannot write random seed file '" << opt_writeSeedFile << "', ignoring");
+        return 1;
         }
       } else {
         OFLOG_ERROR(findscuLogger, "cannot write random seed, ignoring");
+      return 1;
       }
     }
     delete tLayer;


P.S. I had to resort to calling external findscu process to allow multiple queries from different threads in my program at the same time. Are there any plans to make the networking/sockets portion of the code thread safe?

Thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group