Mercurial > hg > orthanc
view Resources/Patches/dcmtk-3.6.0-speed.patch @ 2637:5094369664f0
Avoid unnecessary calls to the database if there is no Lua callback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 May 2018 10:54:59 +0200 |
parents | bfcf5a7f92e7 |
children |
line wrap: on
line source
diff -urEb dcmtk-3.6.0.orig/dcmnet/libsrc/dul.cc dcmtk-3.6.0/dcmnet/libsrc/dul.cc --- dcmtk-3.6.0.orig/dcmnet/libsrc/dul.cc 2017-03-17 15:49:23.043061969 +0100 +++ dcmtk-3.6.0/dcmnet/libsrc/dul.cc 2017-03-17 15:50:44.075359547 +0100 @@ -630,7 +630,10 @@ if (cond.bad()) return cond; - cond = PRV_NextPDUType(association, block, timeout, &pduType); + /* This is the first time we read from this new connection, so in case it + * doesn't speak DICOM, we shouldn't wait forever (= DUL_NOBLOCK). + */ + cond = PRV_NextPDUType(association, DUL_NOBLOCK, PRV_DEFAULTTIMEOUT, &pduType); if (cond == DUL_NETWORKCLOSED) event = TRANS_CONN_CLOSED; @@ -1770,7 +1773,7 @@ // send number of socket handle in child process over anonymous pipe DWORD bytesWritten; char buf[20]; - sprintf(buf, "%i", OFreinterpret_cast(int, childSocketHandle)); + sprintf(buf, "%i", OFstatic_cast(int, OFreinterpret_cast(size_t, childSocketHandle))); if (!WriteFile(hChildStdInWriteDup, buf, strlen(buf) + 1, &bytesWritten, NULL)) { CloseHandle(hChildStdInWriteDup); @@ -1780,7 +1783,7 @@ // return OF_ok status code DULC_FORKEDCHILD with descriptive text OFOStringStream stream; stream << "New child process started with pid " << OFstatic_cast(int, pi.dwProcessId) - << ", socketHandle " << OFreinterpret_cast(int, childSocketHandle) << OFStringStream_ends; + << ", socketHandle " << OFstatic_cast(int, OFreinterpret_cast(size_t, childSocketHandle)) << OFStringStream_ends; OFSTRINGSTREAM_GETOFSTRING(stream, msg) return makeDcmnetCondition(DULC_FORKEDCHILD, OF_ok, msg.c_str()); } @@ -1840,7 +1843,7 @@ } #endif #endif - setTCPBufferLength(sock); + //setTCPBufferLength(sock); #ifndef DONT_DISABLE_NAGLE_ALGORITHM /* diff -urEb dcmtk-3.6.0.orig/dcmnet/libsrc/dulfsm.cc dcmtk-3.6.0/dcmnet/libsrc/dulfsm.cc --- dcmtk-3.6.0.orig/dcmnet/libsrc/dulfsm.cc 2017-03-17 15:49:23.043061969 +0100 +++ dcmtk-3.6.0/dcmnet/libsrc/dulfsm.cc 2017-03-17 15:49:48.467144792 +0100 @@ -2417,7 +2417,7 @@ return makeDcmnetCondition(DULC_TCPINITERROR, OF_error, msg.c_str()); } #endif - setTCPBufferLength(s); + //setTCPBufferLength(s); #ifndef DONT_DISABLE_NAGLE_ALGORITHM /*