summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2013-07-26 09:09:03 +0200
committerBenoit Foucher <benoit@zeroc.com>2013-07-26 09:09:03 +0200
commit1e6a694714985125f37bf67dc5d35fd76fc7a33f (patch)
tree92dbf46286fcd8d02010b00093907511be8ab08d /cpp/test
parentICE-5313 - more fixes for checksums (diff)
downloadice-1e6a694714985125f37bf67dc5d35fd76fc7a33f.tar.bz2
ice-1e6a694714985125f37bf67dc5d35fd76fc7a33f.tar.xz
ice-1e6a694714985125f37bf67dc5d35fd76fc7a33f.zip
Revert "Fix to allow transceivers to read more data than requested."
This reverts commit 9c4e79ce6760badf047568fd300fcbe3455f31b7.
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Ice/background/AllTests.cpp25
-rw-r--r--cpp/test/Ice/background/Configuration.cpp17
-rw-r--r--cpp/test/Ice/background/Configuration.h46
-rw-r--r--cpp/test/Ice/background/Test.ice2
-rw-r--r--cpp/test/Ice/background/TestI.cpp6
-rw-r--r--cpp/test/Ice/background/TestI.h2
-rw-r--r--cpp/test/Ice/background/Transceiver.cpp108
-rw-r--r--cpp/test/Ice/background/Transceiver.h7
8 files changed, 34 insertions, 179 deletions
diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp
index b6db7300986..1d21b70379c 100644
--- a/cpp/test/Ice/background/AllTests.cpp
+++ b/cpp/test/Ice/background/AllTests.cpp
@@ -313,28 +313,6 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
cout << "ok" << endl;
- cout << "testing buffered transport... " << flush;
- {
- configuration->buffered(true);
- backgroundController->buffered(true);
- Ice::AsyncResultPtr r;
- for(int i = 0; i < 10000; ++i)
- {
- r = background->begin_op();
- if(i % 50 == 0)
- {
- backgroundController->holdAdapter();
- backgroundController->resumeAdapter();
- }
- if(i % 100 == 0)
- {
- r->waitForCompleted();
- }
- }
- r->waitForCompleted();
- }
- cout << "ok" << endl;
-
return background;
}
@@ -444,8 +422,9 @@ initializeTests(const ConfigurationPtr& configuration,
{
background->op();
}
- catch(const Ice::LocalException&)
+ catch(const Ice::LocalException& ex)
{
+ cerr << ex << endl;
test(false);
}
background->ice_getConnection()->close(false);
diff --git a/cpp/test/Ice/background/Configuration.cpp b/cpp/test/Ice/background/Configuration.cpp
index 45bc7872a6f..4a3e9498d04 100644
--- a/cpp/test/Ice/background/Configuration.cpp
+++ b/cpp/test/Ice/background/Configuration.cpp
@@ -15,8 +15,7 @@ Configuration::Configuration() :
_initializeSocketOperation(IceInternal::SocketOperationNone),
_initializeResetCount(0),
_readReadyCount(0),
- _writeReadyCount(0),
- _buffered(false)
+ _writeReadyCount(0)
{
assert(!_instance);
_instance = this;
@@ -175,20 +174,6 @@ Configuration::checkWriteException()
}
}
-void
-Configuration::buffered(bool buffered)
-{
- Lock sync(*this);
- _buffered = buffered;
-}
-
-bool
-Configuration::buffered()
-{
- Lock sync(*this);
- return _buffered;
-}
-
Configuration*
Configuration::getInstance()
{
diff --git a/cpp/test/Ice/background/Configuration.h b/cpp/test/Ice/background/Configuration.h
index ddcedc2d3f9..9f0ff1ab634 100644
--- a/cpp/test/Ice/background/Configuration.h
+++ b/cpp/test/Ice/background/Configuration.h
@@ -25,30 +25,27 @@ public:
Configuration();
virtual ~Configuration();
- void connectorsException(Ice::LocalException*);
- void checkConnectorsException();
-
- void connectException(Ice::LocalException*);
- void checkConnectException();
-
- void initializeSocketOperation(IceInternal::SocketOperation);
- void initializeException(Ice::LocalException*);
- IceInternal::SocketOperation initializeSocketOperation();
- void checkInitializeException();
-
- void readReady(bool);
- void readException(Ice::LocalException*);
- bool readReady();
- void checkReadException();
-
- void writeReady(bool);
- void writeException(Ice::LocalException*);
- bool writeReady();
- void checkWriteException();
-
- void buffered(bool);
- bool buffered();
-
+ virtual void connectorsException(Ice::LocalException*);
+ virtual void checkConnectorsException();
+
+ virtual void connectException(Ice::LocalException*);
+ virtual void checkConnectException();
+
+ virtual void initializeSocketOperation(IceInternal::SocketOperation);
+ virtual void initializeException(Ice::LocalException*);
+ virtual IceInternal::SocketOperation initializeSocketOperation();
+ virtual void checkInitializeException();
+
+ virtual void readReady(bool);
+ virtual void readException(Ice::LocalException*);
+ virtual bool readReady();
+ virtual void checkReadException();
+
+ virtual void writeReady(bool);
+ virtual void writeException(Ice::LocalException*);
+ virtual bool writeReady();
+ virtual void checkWriteException();
+
static Configuration* getInstance();
private:
@@ -62,7 +59,6 @@ private:
IceUtil::UniquePtr<Ice::LocalException> _readException;
int _writeReadyCount;
IceUtil::UniquePtr<Ice::LocalException> _writeException;
- bool _buffered;
static Configuration* _instance;
};
diff --git a/cpp/test/Ice/background/Test.ice b/cpp/test/Ice/background/Test.ice
index 2c2ece09398..6fff0d79750 100644
--- a/cpp/test/Ice/background/Test.ice
+++ b/cpp/test/Ice/background/Test.ice
@@ -39,8 +39,6 @@ interface BackgroundController
void writeReady(bool enable);
void writeException(bool enable);
-
- void buffered(bool enable);
};
};
diff --git a/cpp/test/Ice/background/TestI.cpp b/cpp/test/Ice/background/TestI.cpp
index 0e6a44cc6cd..26cb121abb4 100644
--- a/cpp/test/Ice/background/TestI.cpp
+++ b/cpp/test/Ice/background/TestI.cpp
@@ -109,12 +109,6 @@ BackgroundControllerI::writeException(bool enable, const Ice::Current&)
_configuration->writeException(enable ? new Ice::SocketException(__FILE__, __LINE__) : 0);
}
-void
-BackgroundControllerI::buffered(bool enable, const Ice::Current&)
-{
- _configuration->buffered(enable);
-}
-
BackgroundControllerI::BackgroundControllerI(const Ice::ObjectAdapterPtr& adapter,
const ConfigurationPtr& configuration) :
_adapter(adapter),
diff --git a/cpp/test/Ice/background/TestI.h b/cpp/test/Ice/background/TestI.h
index 34bc097808e..7dfe67d2fed 100644
--- a/cpp/test/Ice/background/TestI.h
+++ b/cpp/test/Ice/background/TestI.h
@@ -53,8 +53,6 @@ public:
virtual void writeReady(bool, const Ice::Current&);
virtual void writeException(bool, const Ice::Current&);
-
- virtual void buffered(bool, const Ice::Current&);
BackgroundControllerI(const Ice::ObjectAdapterPtr&, const ConfigurationPtr&);
diff --git a/cpp/test/Ice/background/Transceiver.cpp b/cpp/test/Ice/background/Transceiver.cpp
index 5260c7b024d..03e99934561 100644
--- a/cpp/test/Ice/background/Transceiver.cpp
+++ b/cpp/test/Ice/background/Transceiver.cpp
@@ -18,7 +18,7 @@ Transceiver::getNativeInfo()
}
IceInternal::SocketOperation
-Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer, bool& hasMoreData)
+Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer)
{
#ifndef ICE_USE_IOCP
IceInternal::SocketOperation status = _configuration->initializeSocketOperation();
@@ -30,7 +30,7 @@ Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& wr
{
if(!_initialized)
{
- status = _transceiver->initialize(readBuffer, writeBuffer, hasMoreData);
+ status = _transceiver->initialize(readBuffer, writeBuffer);
if(status != IceInternal::SocketOperationNone)
{
return status;
@@ -48,7 +48,7 @@ Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& wr
_configuration->checkInitializeException();
if(!_initialized)
{
- IceInternal::SocketOperation status = _transceiver->initialize(readBuffer, writeBuffer, hasMoreData);
+ IceInternal::SocketOperation status = _transceiver->initialize(readBuffer, writeBuffer);
if(status != IceInternal::SocketOperationNone)
{
return status;
@@ -77,7 +77,7 @@ Transceiver::write(IceInternal::Buffer& buf)
}
bool
-Transceiver::read(IceInternal::Buffer& buf, bool& moreData)
+Transceiver::read(IceInternal::Buffer& buf)
{
if(!_configuration->readReady())
{
@@ -85,41 +85,7 @@ Transceiver::read(IceInternal::Buffer& buf, bool& moreData)
}
_configuration->checkReadException();
-
- if(_configuration->buffered())
- {
- while(buf.i != buf.b.end())
- {
- if(_readBufferPos == _readBuffer.i)
- {
- _readBufferPos = _readBuffer.i = _readBuffer.b.begin();
- _transceiver->read(_readBuffer, moreData);
- if(_readBufferPos == _readBuffer.i)
- {
- moreData = false;
- return false;
- }
- }
- assert(_readBuffer.i > _readBufferPos);
- size_t requested = buf.b.end() - buf.i;
- size_t available = _readBuffer.i - _readBufferPos;
- assert(available > 0);
- if(available >= requested)
- {
- available = requested;
- }
-
- memcpy(buf.i, _readBufferPos, available);
- _readBufferPos += available;
- buf.i += available;
- }
- moreData = _readBufferPos < _readBuffer.i;
- return true;
- }
- else
- {
- return _transceiver->read(buf, moreData);
- }
+ return _transceiver->read(buf);
}
#ifdef ICE_USE_IOCP
@@ -141,67 +107,14 @@ void
Transceiver::startRead(IceInternal::Buffer& buf)
{
_configuration->checkReadException();
- if(_configuration->buffered())
- {
- size_t available = _readBuffer.i - _readBufferPos;
- if(available > 0)
- {
- size_t requested = buf.b.end() - buf.i;
- assert(available > 0);
- if(available >= requested)
- {
- available = requested;
- }
-
- memcpy(buf.i, _readBufferPos, available);
- _readBufferPos += available;
- buf.i += available;
- }
-
- if(_readBufferPos == _readBuffer.i && buf.i != buf.b.end())
- {
- _readBufferPos = _readBuffer.i = _readBuffer.b.begin();
- _transceiver->startRead(_readBuffer);
- }
- else
- {
- _transceiver->getNativeInfo()->completed(IceInternal::SocketOperationRead);
- }
- }
- else
- {
- _transceiver->startRead(buf);
- }
+ _transceiver->startRead(buf);
}
void
Transceiver::finishRead(IceInternal::Buffer& buf)
{
_configuration->checkReadException();
- if(_configuration->buffered())
- {
- if(buf.i != buf.b.end())
- {
- _transceiver->finishRead(_readBuffer);
-
- assert(_readBuffer.i > _readBufferPos);
- size_t requested = buf.b.end() - buf.i;
- size_t available = _readBuffer.i - _readBufferPos;
- assert(available > 0);
- if(available >= requested)
- {
- available = requested;
- }
-
- memcpy(buf.i, _readBufferPos, available);
- _readBufferPos += available;
- buf.i += available;
- }
- }
- else
- {
- _transceiver->finishRead(buf);
- }
+ _transceiver->finishRead(buf);
}
#endif
@@ -235,11 +148,6 @@ Transceiver::checkSendSize(const IceInternal::Buffer& buf, size_t messageSizeMax
Transceiver::Transceiver(const IceInternal::TransceiverPtr& transceiver) :
_transceiver(transceiver),
_configuration(Configuration::getInstance()),
- _initialized(false),
- _readBuffer(0)
+ _initialized(false)
{
- _readBuffer.b.resize(1024 * 8); // 8KB buffer
- _readBufferPos = _readBuffer.b.begin();
- _readBuffer.i = _readBuffer.b.begin();
}
-
diff --git a/cpp/test/Ice/background/Transceiver.h b/cpp/test/Ice/background/Transceiver.h
index b6e06d40510..770272557b2 100644
--- a/cpp/test/Ice/background/Transceiver.h
+++ b/cpp/test/Ice/background/Transceiver.h
@@ -21,7 +21,7 @@ public:
virtual void close();
virtual bool write(IceInternal::Buffer&);
- virtual bool read(IceInternal::Buffer&, bool&);
+ virtual bool read(IceInternal::Buffer&);
#ifdef ICE_USE_IOCP
virtual bool startWrite(IceInternal::Buffer&);
virtual void finishWrite(IceInternal::Buffer&);
@@ -31,7 +31,7 @@ public:
virtual std::string type() const;
virtual std::string toString() const;
virtual Ice::ConnectionInfoPtr getInfo() const;
- virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&, bool&);
+ virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
virtual void checkSendSize(const IceInternal::Buffer&, size_t);
private:
@@ -44,9 +44,6 @@ private:
const IceInternal::TransceiverPtr _transceiver;
const ConfigurationPtr _configuration;
bool _initialized;
-
- IceInternal::Buffer _readBuffer;
- IceInternal::Buffer::Container::const_iterator _readBufferPos;
};
#endif