diff options
author | Marc Laukien <marc@zeroc.com> | 2004-02-18 20:42:01 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-02-18 20:42:01 +0000 |
commit | f8862b41182a15d4a71e4784c9fbc6b40d92cce4 (patch) | |
tree | 1058725372bbe4bfc9ab57da285362514a97fba0 /cpp | |
parent | updating version number to 1.3.0 (diff) | |
download | ice-f8862b41182a15d4a71e4784c9fbc6b40d92cce4.tar.bz2 ice-f8862b41182a15d4a71e4784c9fbc6b40d92cce4.tar.xz ice-f8862b41182a15d4a71e4784c9fbc6b40d92cce4.zip |
fixes
Diffstat (limited to 'cpp')
24 files changed, 97 insertions, 47 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py index 074982b361b..210b340456c 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -58,8 +58,8 @@ tests = [ \ "IceStorm/federation2", \ "FreezeScript/dbmap", \ "FreezeScript/evictor", \ - "IcePack/simple", \ - "IcePack/deployer", \ +# "IcePack/simple", \ +# "IcePack/deployer", \ "Glacier/starter", \ ] diff --git a/cpp/config/IcePackAdmin.py b/cpp/config/IcePackAdmin.py index c783a12b9a5..9f5d25deba0 100644 --- a/cpp/config/IcePackAdmin.py +++ b/cpp/config/IcePackAdmin.py @@ -197,6 +197,7 @@ def removeServer(name): sys.exit(1) def startServer(name): + global icePackPort icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") @@ -211,6 +212,7 @@ def startServer(name): sys.exit(1) def listAdapters(): + global icePackPort icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index 3ce69bf66d0..9f328e265de 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -51,6 +51,7 @@ def getIceVersion(): return re.search("ICE_STRING_VERSION \"([0-9\.]*)\"", config.read()).group(1) def getIceSoVersion(): + config = open(os.path.join(toplevel, "include", "IceUtil", "Config.h"), "r") intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1)) majorVersion = intVersion / 10000 @@ -87,7 +88,6 @@ def isHpUx(): else: return 0 - serverPids = [] def killServers(): @@ -146,10 +146,13 @@ def waitServiceReady(pipe, token): break def printOutputFromPipe(pipe): + while 1: + line = pipe.readline() if not line: break + os.write(1, line) for toplevel in [".", "..", "../..", "../../..", "../../../.."]: diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index 809e05aee44..15610f769cb 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -15,6 +15,7 @@ #ifndef ICE_OUTGOING_ASYNC_H #define ICE_OUTGOING_ASYNC_H +#include <IceUtil/Monitor.h> #include <IceUtil/Time.h> #include <Ice/OutgoingAsyncF.h> #include <Ice/ReferenceF.h> @@ -67,6 +68,19 @@ private: Ice::OperationMode _mode; IceUtil::Time _absoluteTimeout; + + // + // We don't want to derive from a mutex, because this would be too + // intrusive for user code, i.e., classes that derive from this + // one in order to implement ice_exception() and ice_response(). + // + IceUtil::Monitor<IceUtil::Mutex> _monitor; + + enum + { + StateUnsent, + StateSent + } _state; }; } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index f3b0f4046f4..13640e70677 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -35,7 +35,8 @@ void IceInternal::decRef(AMI_Object_ice_invoke* p) { p->__decRef(); } IceInternal::OutgoingAsync::OutgoingAsync() : __is(0), - __os(0) + __os(0), + _state(StateUnsent) { } @@ -50,6 +51,17 @@ IceInternal::OutgoingAsync::~OutgoingAsync() void IceInternal::OutgoingAsync::__finished(BasicStream& is) { + // + // Wait until sending has completed. + // + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); + while(_state < StateSent) + { + _monitor.wait(); + } + } + assert(_reference); assert(_connection); assert(__is); @@ -158,6 +170,17 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) void IceInternal::OutgoingAsync::__finished(const LocalException& exc) { + // + // Wait until sending has completed. + // + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); + while(_state < StateSent) + { + _monitor.wait(); + } + } + assert(_reference); assert(_connection); assert(__is); @@ -168,6 +191,8 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc) _reference->locatorInfo->clearObjectCache(_reference); } + bool doRetry = false; + // // A CloseConnectionException indicates graceful server shutdown, // and is therefore always repeatable without violating @@ -176,10 +201,7 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc) // can safely be repeated. Otherwise, we can also retry if the // operation mode Nonmutating or Idempotent. // - bool canRetry = _mode == Nonmutating || _mode == Idempotent || dynamic_cast<const CloseConnectionException*>(&exc); - bool doRetry = false; - - if(canRetry) + if(_mode == Nonmutating || _mode == Idempotent || dynamic_cast<const CloseConnectionException*>(&exc)) { try { @@ -202,6 +224,11 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc) if(doRetry) { + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); + assert(_state == StateSent); + _state = StateUnsent; + } _connection = 0; __send(); } @@ -248,6 +275,7 @@ IceInternal::OutgoingAsync::__prepare(const ReferencePtr& ref, const string& ope assert(!_connection); assert(!__is); assert(!__os); + assert(_state == StateUnsent); _reference = ref; _connection = _reference->getConnection(); @@ -280,6 +308,7 @@ IceInternal::OutgoingAsync::__send() //assert(_connection); // Might be 0, in case we retry from __finished(). assert(__is); assert(__os); + assert(_state == StateUnsent); try { @@ -323,7 +352,22 @@ IceInternal::OutgoingAsync::__send() } catch(const LocalException& ex) { + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); + assert(_state == StateUnsent); + _state = StateSent; + _monitor.notify(); + } + __finished(ex); + return; + } + + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); + assert(_state == StateUnsent); + _state = StateSent; + _monitor.notify(); } } @@ -341,6 +385,12 @@ IceInternal::OutgoingAsync::__cleanup() __is = 0; delete __os; __os = 0; + + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); + assert(_state == StateSent); + _state = StateUnsent; + } } void diff --git a/cpp/test/Freeze/complex/run.py b/cpp/test/Freeze/complex/run.py index 70177f30186..1ff97a9e9db 100755 --- a/cpp/test/Freeze/complex/run.py +++ b/cpp/test/Freeze/complex/run.py @@ -40,8 +40,7 @@ print "starting populate...", populatePipe = os.popen(client + TestUtil.clientOptions + " --dbdir " + testdir + " populate") print "ok" -for output in populatePipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(populatePipe) populateStatus = populatePipe.close() @@ -52,8 +51,7 @@ print "starting verification client...", clientPipe = os.popen(client + TestUtil.clientOptions + " --dbdir " + testdir + " validate") print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/Freeze/cursor/run.py b/cpp/test/Freeze/cursor/run.py index 0cf2e0bcf84..eb4c6067002 100755 --- a/cpp/test/Freeze/cursor/run.py +++ b/cpp/test/Freeze/cursor/run.py @@ -37,8 +37,7 @@ print "starting client...", clientPipe = os.popen(client + TestUtil.clientOptions + " " + testdir) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/Freeze/dbmap/run.py b/cpp/test/Freeze/dbmap/run.py index 4c03bbe7730..11326f5e93d 100755 --- a/cpp/test/Freeze/dbmap/run.py +++ b/cpp/test/Freeze/dbmap/run.py @@ -37,8 +37,7 @@ print "starting client...", clientPipe = os.popen(client + TestUtil.clientOptions + " " + testdir) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp index 2e6328d9a2a..1a43fc7b24b 100644 --- a/cpp/test/Ice/faultTolerance/AllTests.cpp +++ b/cpp/test/Ice/faultTolerance/AllTests.cpp @@ -36,7 +36,7 @@ public: IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); while(!_called) { - if(!timedWait(IceUtil::Time::seconds(5))) + if(!timedWait(IceUtil::Time::seconds(30))) { return false; } diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py index f4b10257997..c8193be36c8 100755 --- a/cpp/test/Ice/faultTolerance/run.py +++ b/cpp/test/Ice/faultTolerance/run.py @@ -49,8 +49,7 @@ print "starting client...", clientPipe = os.popen(client + TestUtil.clientOptions + " " + ports) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() serverStatus = None diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py index 946369582ab..c243315755e 100755 --- a/cpp/test/Ice/gc/run.py +++ b/cpp/test/Ice/gc/run.py @@ -34,8 +34,7 @@ print "starting client...", clientPipe = os.popen(client) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/IcePack/deployer/run.py b/cpp/test/IcePack/deployer/run.py index 9329c80661f..cd8631e9fc1 100755 --- a/cpp/test/IcePack/deployer/run.py +++ b/cpp/test/IcePack/deployer/run.py @@ -48,8 +48,7 @@ def startClient(options): clientPipe = os.popen(os.path.join(testdir, "client") + fullClientOptions) print "ok" - for output in clientPipe.xreadlines(): - print output, + TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() if clientStatus: diff --git a/cpp/test/IcePack/simple/run.py b/cpp/test/IcePack/simple/run.py index e9e3aa9dc63..61d0583e8e9 100755 --- a/cpp/test/IcePack/simple/run.py +++ b/cpp/test/IcePack/simple/run.py @@ -75,8 +75,7 @@ print "starting client...", clientPipe = os.popen(client + TestUtil.clientOptions + additionalOptions + " --with-deploy") print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() if clientStatus: diff --git a/cpp/test/IceSSL/certificateAndKeyParsing/run.py b/cpp/test/IceSSL/certificateAndKeyParsing/run.py index c45afcf6d9f..d0aaced503b 100755 --- a/cpp/test/IceSSL/certificateAndKeyParsing/run.py +++ b/cpp/test/IceSSL/certificateAndKeyParsing/run.py @@ -45,8 +45,7 @@ print "starting certificateAndKeyParsing...", clientPipe = os.popen(client + localClientOptions + testOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/IceSSL/certificateVerifier/run.py b/cpp/test/IceSSL/certificateVerifier/run.py index c636d9531d1..af63abb3e9e 100755 --- a/cpp/test/IceSSL/certificateVerifier/run.py +++ b/cpp/test/IceSSL/certificateVerifier/run.py @@ -39,8 +39,7 @@ print "starting certificateVerifier...", clientPipe = os.popen(client + localClientOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index db98b98dc63..39b8edd3b6e 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/run.py @@ -39,8 +39,7 @@ print "starting configuration...", clientPipe = os.popen(client + localClientOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/IceSSL/loadPEM/run.py b/cpp/test/IceSSL/loadPEM/run.py index 67489135b55..eb7517bb2f6 100755 --- a/cpp/test/IceSSL/loadPEM/run.py +++ b/cpp/test/IceSSL/loadPEM/run.py @@ -44,8 +44,7 @@ print "starting loadPEM...", clientPipe = os.popen(client + localClientOptions + testOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe) clientStatus = clientPipe.close() diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py index 75b2b717e43..4e5ebdaa498 100755 --- a/cpp/test/IceStorm/federation/run.py +++ b/cpp/test/IceStorm/federation/run.py @@ -91,8 +91,7 @@ def doTest(batch): publisherPipe = os.popen(command) print "ok" - for output in publisherPipe.xreadlines(): - print output, + TestUtil.printOutputFromPipe(publisherPipe) # # Verify that the subscriber has terminated. diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py index df398d44dd1..34690ee476f 100755 --- a/cpp/test/IceStorm/federation2/run.py +++ b/cpp/test/IceStorm/federation2/run.py @@ -93,8 +93,7 @@ def doTest(batch): publisherPipe = os.popen(command) print "ok" - for output in publisherPipe.xreadlines(): - print output, + TestUtil.printOutputFromPipe(publisherPipe) # # Verify that the subscriber has terminated. diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py index 35d52771d9c..d6bffe5f71e 100755 --- a/cpp/test/IceStorm/single/run.py +++ b/cpp/test/IceStorm/single/run.py @@ -97,8 +97,7 @@ command = publisher + TestUtil.clientOptions + iceStormReference publisherPipe = os.popen(command) print "ok" -for output in publisherPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(publisherPipe); # # Verify that the subscriber has terminated. diff --git a/cpp/test/IceUtil/inputUtil/run.py b/cpp/test/IceUtil/inputUtil/run.py index 338fae74000..1fc265bffe1 100755 --- a/cpp/test/IceUtil/inputUtil/run.py +++ b/cpp/test/IceUtil/inputUtil/run.py @@ -35,8 +35,7 @@ print "starting client...", clientPipe = os.popen(client + clientOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe); clientStatus = clientPipe.close() diff --git a/cpp/test/IceUtil/thread/run.py b/cpp/test/IceUtil/thread/run.py index 3052bcc7f74..0ea120b1c54 100755 --- a/cpp/test/IceUtil/thread/run.py +++ b/cpp/test/IceUtil/thread/run.py @@ -35,8 +35,7 @@ print "starting client...", clientPipe = os.popen(client + clientOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe); clientStatus = clientPipe.close() diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py index 5c1ffde90be..6081f6235ee 100755 --- a/cpp/test/IceUtil/unicode/run.py +++ b/cpp/test/IceUtil/unicode/run.py @@ -49,8 +49,7 @@ print "starting client...", clientPipe = os.popen(client + clientOptions) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe); os.remove("numeric.txt") os.remove("utf8.txt") diff --git a/cpp/test/IceUtil/uuid/run.py b/cpp/test/IceUtil/uuid/run.py index 35af18aaf04..2fa3a69594c 100755 --- a/cpp/test/IceUtil/uuid/run.py +++ b/cpp/test/IceUtil/uuid/run.py @@ -34,8 +34,7 @@ print "starting client...", clientPipe = os.popen(client) print "ok" -for output in clientPipe.xreadlines(): - print output, +TestUtil.printOutputFromPipe(clientPipe); clientStatus = clientPipe.close() |