From 12ed2b962410ed8af59ee6ecbc592c30beda993c Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 29 Jun 2007 18:56:11 +0000 Subject: * More work on asychronous network IO * Fix of current EventQueue code to carry on compiling git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@552001 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 100 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 qpid/cpp/src/qpid/sys/AsynchIO.h (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h new file mode 100644 index 0000000000..b346c11706 --- /dev/null +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -0,0 +1,100 @@ +#ifndef _sys_AsynchIO +#define _sys_AsynchIO +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "Dispatcher.h" + +#include +#include + +namespace qpid { +namespace sys { + +/* + * Asynchronous acceptor: accepts connections then does a callback with the + * accepted fd + */ +class AsynchAcceptor { +public: + typedef boost::function1 Callback; + +private: + Callback acceptedCallback; + DispatchHandle handle; + +public: + AsynchAcceptor(int fd, Callback callback); + void start(Poller::shared_ptr poller); + +private: + void readable(DispatchHandle& handle); +}; + +/* + * Asycnchronous reader/writer: + * Reader accepts buffers to read into; reads into the provided buffers + * and then does a callback with the buffer and amount read. Optionally it can callback + * when there is something to read but no buffer to read it into. + * + * Writer accepts a buffer and queues it for writing; can also be given + * a callback for when writing is "idle" (ie fd is writable, but nothing to write) + */ +class AsynchIO { +public: + struct Buffer { + char* const bytes; + const int32_t byteCount; + + Buffer(char* const b, const int32_t s) : + bytes(b), + byteCount(s) + {} + }; + + typedef boost::function2 ReadCallback; + typedef boost::function0 EofCallback; + typedef boost::function0 BuffersEmptyCallback; + typedef boost::function1 IdleCallback; + +private: + ReadCallback readCallback; + EofCallback eofCallback; + BuffersEmptyCallback emptyCallback; + IdleCallback idleCallback; + DispatchHandle handle; + std::deque bufferQueue; + std::deque writeQueue; + +public: + AsynchIO(int fd, ReadCallback rCb, EofCallback eofCb, BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0); + void start(Poller::shared_ptr poller); + void QueueReadBuffer(const Buffer& buff); + void QueueWrite(const Buffer& buff); + +private: + void readable(DispatchHandle& handle); + void writeable(DispatchHandle& handle); +}; + +}} + +#endif // _sys_AsynchIO -- cgit v1.2.1 From fd9fdc0bee6198dfcc8771cb733fd044d923a317 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 12 Jul 2007 01:48:13 +0000 Subject: * Add libuuid to libcommon link (for when apr goes away) * Latest version of AsynchIO code git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@555455 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 43 +++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index b346c11706..7accde17b0 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -57,42 +57,61 @@ private: * * Writer accepts a buffer and queues it for writing; can also be given * a callback for when writing is "idle" (ie fd is writable, but nothing to write) + * + * The class is implemented in terms of DispatchHandle to allow it to be deleted by deleting + * the contained DispatchHandle */ -class AsynchIO { +class AsynchIO : private DispatchHandle { public: struct Buffer { + typedef boost::function1 RecycleStorage; + char* const bytes; const int32_t byteCount; + int32_t dataStart; + int32_t dataCount; Buffer(char* const b, const int32_t s) : bytes(b), - byteCount(s) + byteCount(s), + dataStart(0), + dataCount(s) + {} + + virtual ~Buffer() {} }; - typedef boost::function2 ReadCallback; - typedef boost::function0 EofCallback; - typedef boost::function0 BuffersEmptyCallback; - typedef boost::function1 IdleCallback; + typedef boost::function2 ReadCallback; + typedef boost::function1 EofCallback; + typedef boost::function1 DisconnectCallback; + typedef boost::function1 BuffersEmptyCallback; + typedef boost::function1 IdleCallback; private: ReadCallback readCallback; EofCallback eofCallback; + DisconnectCallback disCallback; BuffersEmptyCallback emptyCallback; IdleCallback idleCallback; - DispatchHandle handle; - std::deque bufferQueue; - std::deque writeQueue; + std::deque bufferQueue; + std::deque writeQueue; public: - AsynchIO(int fd, ReadCallback rCb, EofCallback eofCb, BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0); + AsynchIO(int fd, + ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb, + BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0); + void queueForDeletion(); + void start(Poller::shared_ptr poller); - void QueueReadBuffer(const Buffer& buff); - void QueueWrite(const Buffer& buff); + void queueReadBuffer(Buffer* buff); + void queueWrite(Buffer* buff); private: + ~AsynchIO(); void readable(DispatchHandle& handle); void writeable(DispatchHandle& handle); + void disconnected(DispatchHandle& handle); }; }} -- cgit v1.2.1 From 008544afce4d981650212d01db21d8a94f18e562 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 27 Jul 2007 17:19:30 +0000 Subject: * Asynchronous network IO subsystem - This is now implemented such that it very nearly only depends on the platform code (Socker & Poller), this is not 100% true at present, but should be simple to finish. - This is still not the default (use "./configure --disable-apr-netio" to get it) - Interrupting the broker gives a known error - Default for number of broker io threads is not correct (needs to be number of CPUs - it will run slower with too many io threads) * EventChannel code - Deleted all EventChannel code as it's entirely superceded by this new shiny code ;-) * Rearranged the platform Socket implementations a bit for better abstraction git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@560323 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 7accde17b0..7cc7995ee2 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -35,14 +35,14 @@ namespace sys { */ class AsynchAcceptor { public: - typedef boost::function1 Callback; + typedef boost::function1 Callback; private: Callback acceptedCallback; DispatchHandle handle; public: - AsynchAcceptor(int fd, Callback callback); + AsynchAcceptor(const Socket& s, Callback callback); void start(Poller::shared_ptr poller); private: @@ -75,9 +75,9 @@ public: bytes(b), byteCount(s), dataStart(0), - dataCount(s) + dataCount(0) {} - + virtual ~Buffer() {} }; @@ -85,6 +85,7 @@ public: typedef boost::function2 ReadCallback; typedef boost::function1 EofCallback; typedef boost::function1 DisconnectCallback; + typedef boost::function2 ClosedCallback; typedef boost::function1 BuffersEmptyCallback; typedef boost::function1 IdleCallback; @@ -92,26 +93,33 @@ private: ReadCallback readCallback; EofCallback eofCallback; DisconnectCallback disCallback; + ClosedCallback closedCallback; BuffersEmptyCallback emptyCallback; IdleCallback idleCallback; std::deque bufferQueue; std::deque writeQueue; + bool queuedClose; public: - AsynchIO(int fd, + AsynchIO(const Socket& s, ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb, - BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0); + ClosedCallback cCb = 0, BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0); void queueForDeletion(); void start(Poller::shared_ptr poller); void queueReadBuffer(Buffer* buff); - void queueWrite(Buffer* buff); + void queueWrite(Buffer* buff = 0); + void unread(Buffer* buff); + void queueWriteClose(); + Buffer* getQueuedBuffer(); + const Socket& getSocket() const { return DispatchHandle::getSocket(); } private: ~AsynchIO(); void readable(DispatchHandle& handle); void writeable(DispatchHandle& handle); void disconnected(DispatchHandle& handle); + void close(DispatchHandle& handle); }; }} -- cgit v1.2.1 From 0bc9a47a7c35f8cf67ef0e92cc53c91e66a6deec Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 31 Aug 2007 18:20:29 +0000 Subject: * Changes to make C++ client code use the asynchronous network IO * Fixed up the test for buffer changes * Removed unused buffer operations git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@571529 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 7cc7995ee2..ea2badf456 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -63,26 +63,24 @@ private: */ class AsynchIO : private DispatchHandle { public: - struct Buffer { - typedef boost::function1 RecycleStorage; - + struct BufferBase { char* const bytes; const int32_t byteCount; int32_t dataStart; int32_t dataCount; - Buffer(char* const b, const int32_t s) : + BufferBase(char* const b, const int32_t s) : bytes(b), byteCount(s), dataStart(0), dataCount(0) {} - virtual ~Buffer() + virtual ~BufferBase() {} }; - typedef boost::function2 ReadCallback; + typedef boost::function2 ReadCallback; typedef boost::function1 EofCallback; typedef boost::function1 DisconnectCallback; typedef boost::function2 ClosedCallback; @@ -96,8 +94,8 @@ private: ClosedCallback closedCallback; BuffersEmptyCallback emptyCallback; IdleCallback idleCallback; - std::deque bufferQueue; - std::deque writeQueue; + std::deque bufferQueue; + std::deque writeQueue; bool queuedClose; public: @@ -107,11 +105,11 @@ public: void queueForDeletion(); void start(Poller::shared_ptr poller); - void queueReadBuffer(Buffer* buff); - void queueWrite(Buffer* buff = 0); - void unread(Buffer* buff); + void queueReadBuffer(BufferBase* buff); + void queueWrite(BufferBase* buff = 0); + void unread(BufferBase* buff); void queueWriteClose(); - Buffer* getQueuedBuffer(); + BufferBase* getQueuedBuffer(); const Socket& getSocket() const { return DispatchHandle::getSocket(); } private: -- cgit v1.2.1 From 5ae07a02807d97b259321e002060caa3cbe80054 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 16 Oct 2007 11:58:00 +0000 Subject: Log a warning if we close a connection with unsent data git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@585127 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index ea2badf456..7cb56b30aa 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -106,9 +106,10 @@ public: void start(Poller::shared_ptr poller); void queueReadBuffer(BufferBase* buff); - void queueWrite(BufferBase* buff = 0); void unread(BufferBase* buff); + void queueWrite(BufferBase* buff = 0); void queueWriteClose(); + bool writeQueueEmpty() { return writeQueue.empty(); } BufferBase* getQueuedBuffer(); const Socket& getSocket() const { return DispatchHandle::getSocket(); } -- cgit v1.2.1 From cec3036ee673998e83a2985c4fe6d19ec62c4c13 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 29 Nov 2007 11:54:17 +0000 Subject: Changes to threading: queues serialiser removed, io threads used to drive dispatch to consumers Fix to PersistableMessage: use correct lock when accessing synclist, don't hold enqueue lock when notifying queues git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@599395 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 7cb56b30aa..ca34d82741 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -97,6 +97,13 @@ private: std::deque bufferQueue; std::deque writeQueue; bool queuedClose; + /** + * This flag is used to detect and handle concurrency between + * calls to notifyPendingWrite() (which can be made from any thread) and + * the execution of the writeable() method (which is always on the + * thread processing this handle. + */ + volatile bool writePending; public: AsynchIO(const Socket& s, @@ -107,7 +114,8 @@ public: void start(Poller::shared_ptr poller); void queueReadBuffer(BufferBase* buff); void unread(BufferBase* buff); - void queueWrite(BufferBase* buff = 0); + void queueWrite(BufferBase* buff); + void notifyPendingWrite(); void queueWriteClose(); bool writeQueueEmpty() { return writeQueue.empty(); } BufferBase* getQueuedBuffer(); -- cgit v1.2.1 From 7bf3ed2b4bca4706e3837126d597ae5d2ee11537 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 15 Apr 2008 15:41:21 +0000 Subject: Refactored the IO framework that sits on top of Poller so that it uses a generalised IOHandle. This means that you can define new classes derived from IOHandle (other than Socket) that can also be added to a Poller and waited for. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@648288 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index ca34d82741..3bcee8ba22 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -40,6 +40,7 @@ public: private: Callback acceptedCallback; DispatchHandle handle; + const Socket& socket; public: AsynchAcceptor(const Socket& s, Callback callback); @@ -94,6 +95,7 @@ private: ClosedCallback closedCallback; BuffersEmptyCallback emptyCallback; IdleCallback idleCallback; + const Socket& socket; std::deque bufferQueue; std::deque writeQueue; bool queuedClose; @@ -119,7 +121,6 @@ public: void queueWriteClose(); bool writeQueueEmpty() { return writeQueue.empty(); } BufferBase* getQueuedBuffer(); - const Socket& getSocket() const { return DispatchHandle::getSocket(); } private: ~AsynchIO(); -- cgit v1.2.1 From 697b88452d993aeb7ffac7700d23046564c348c3 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 29 Apr 2008 21:05:40 +0000 Subject: Removed some unnecessary #includes git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@652120 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 1 + 1 file changed, 1 insertion(+) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 3bcee8ba22..13bed78e85 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -22,6 +22,7 @@ */ #include "Dispatcher.h" +#include "Socket.h" #include #include -- cgit v1.2.1 From 4bc4dbe0a04787773182f13814e7c1e187a4be9c Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 9 May 2008 02:00:04 +0000 Subject: QPID-1040: Patch from Ted Ross: Asynchronous Connector Code to allow non-blocking connection of new sockets git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@654666 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 13bed78e85..847bdc50e4 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -52,7 +52,34 @@ private: }; /* - * Asycnchronous reader/writer: + * Asynchronous connector: starts the process of initiating a connection and + * invokes a callback when completed or failed. + */ +class AsynchConnector : private DispatchHandle { +public: + typedef boost::function1 ConnectedCallback; + typedef boost::function2 FailedCallback; + +private: + ConnectedCallback connCallback; + FailedCallback failCallback; + const Socket& socket; + +public: + AsynchConnector(const Socket& socket, + Poller::shared_ptr poller, + std::string hostname, + uint16_t port, + ConnectedCallback connCb, + FailedCallback failCb = 0); + +private: + void connComplete(DispatchHandle& handle); + void failure(int, std::string); +}; + +/* + * Asychronous reader/writer: * Reader accepts buffers to read into; reads into the provided buffers * and then does a callback with the buffer and amount read. Optionally it can callback * when there is something to read but no buffer to read it into. -- cgit v1.2.1 From 2a545d4432fb46adedc9fd899a42f69534d4a80a Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Wed, 9 Jul 2008 20:36:17 +0000 Subject: Some small changes which clean up header file inclusions and generally start to tidy up the network layer so that it's a bit easier to implement new network transports git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@675338 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 847bdc50e4..ff7823e00d 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -22,13 +22,14 @@ */ #include "Dispatcher.h" -#include "Socket.h" #include #include namespace qpid { namespace sys { + +class Socket; /* * Asynchronous acceptor: accepts connections then does a callback with the @@ -78,6 +79,23 @@ private: void failure(int, std::string); }; +struct AsynchIOBufferBase { + char* const bytes; + const int32_t byteCount; + int32_t dataStart; + int32_t dataCount; + + AsynchIOBufferBase(char* const b, const int32_t s) : + bytes(b), + byteCount(s), + dataStart(0), + dataCount(0) + {} + + virtual ~AsynchIOBufferBase() + {} +}; + /* * Asychronous reader/writer: * Reader accepts buffers to read into; reads into the provided buffers @@ -92,22 +110,7 @@ private: */ class AsynchIO : private DispatchHandle { public: - struct BufferBase { - char* const bytes; - const int32_t byteCount; - int32_t dataStart; - int32_t dataCount; - - BufferBase(char* const b, const int32_t s) : - bytes(b), - byteCount(s), - dataStart(0), - dataCount(0) - {} - - virtual ~BufferBase() - {} - }; + typedef AsynchIOBufferBase BufferBase; typedef boost::function2 ReadCallback; typedef boost::function1 EofCallback; -- cgit v1.2.1 From 65db1dc07a33aa419b842a34e61fa5781841b0bf Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Tue, 21 Oct 2008 18:29:44 +0000 Subject: Refactor sys::AsynchIO class to allow reimplementing on other platforms without affecting upper level usage. Resolves QPID-1377 and supplies Windows AsynchIO.cpp git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@706709 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 125 +++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 70 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index ff7823e00d..f5c4607992 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -21,7 +21,8 @@ * */ -#include "Dispatcher.h" +// @@TODO: TAKE THIS OUT... SHould be in posix version. +#include "DispatchHandle.h" #include #include @@ -35,48 +36,45 @@ class Socket; * Asynchronous acceptor: accepts connections then does a callback with the * accepted fd */ +class AsynchAcceptorPrivate; class AsynchAcceptor { public: typedef boost::function1 Callback; private: - Callback acceptedCallback; - DispatchHandle handle; - const Socket& socket; + AsynchAcceptorPrivate* impl; public: AsynchAcceptor(const Socket& s, Callback callback); + ~AsynchAcceptor(); void start(Poller::shared_ptr poller); - -private: - void readable(DispatchHandle& handle); }; /* * Asynchronous connector: starts the process of initiating a connection and * invokes a callback when completed or failed. */ -class AsynchConnector : private DispatchHandle { +class AsynchConnector { public: typedef boost::function1 ConnectedCallback; typedef boost::function2 FailedCallback; -private: - ConnectedCallback connCallback; - FailedCallback failCallback; - const Socket& socket; - -public: - AsynchConnector(const Socket& socket, - Poller::shared_ptr poller, - std::string hostname, - uint16_t port, - ConnectedCallback connCb, - FailedCallback failCb = 0); - -private: - void connComplete(DispatchHandle& handle); - void failure(int, std::string); + // Call create() to allocate a new AsynchConnector object with the + // specified poller, addressing, and callbacks. + // This method is implemented in platform-specific code to + // create a correctly typed object. The platform code also manages + // deletes. To correctly manage heaps when needed, the allocate and + // delete should both be done from the same class/library. + static AsynchConnector* create(const Socket& s, + Poller::shared_ptr poller, + std::string hostname, + uint16_t port, + ConnectedCallback connCb, + FailedCallback failCb = 0); + +protected: + AsynchConnector() {} + virtual ~AsynchConnector() {} }; struct AsynchIOBufferBase { @@ -99,16 +97,14 @@ struct AsynchIOBufferBase { /* * Asychronous reader/writer: * Reader accepts buffers to read into; reads into the provided buffers - * and then does a callback with the buffer and amount read. Optionally it can callback - * when there is something to read but no buffer to read it into. + * and then does a callback with the buffer and amount read. Optionally it + * can callback when there is something to read but no buffer to read it into. * * Writer accepts a buffer and queues it for writing; can also be given - * a callback for when writing is "idle" (ie fd is writable, but nothing to write) - * - * The class is implemented in terms of DispatchHandle to allow it to be deleted by deleting - * the contained DispatchHandle + * a callback for when writing is "idle" (ie fd is writable, but nothing + * to write). */ -class AsynchIO : private DispatchHandle { +class AsynchIO { public: typedef AsynchIOBufferBase BufferBase; @@ -119,46 +115,35 @@ public: typedef boost::function1 BuffersEmptyCallback; typedef boost::function1 IdleCallback; -private: - ReadCallback readCallback; - EofCallback eofCallback; - DisconnectCallback disCallback; - ClosedCallback closedCallback; - BuffersEmptyCallback emptyCallback; - IdleCallback idleCallback; - const Socket& socket; - std::deque bufferQueue; - std::deque writeQueue; - bool queuedClose; - /** - * This flag is used to detect and handle concurrency between - * calls to notifyPendingWrite() (which can be made from any thread) and - * the execution of the writeable() method (which is always on the - * thread processing this handle. - */ - volatile bool writePending; - + // Call create() to allocate a new AsynchIO object with the specified + // callbacks. This method is implemented in platform-specific code to + // create a correctly typed object. The platform code also manages + // deletes. To correctly manage heaps when needed, the allocate and + // delete should both be done from the same class/library. + static AsynchIO* create(const Socket& s, + ReadCallback rCb, + EofCallback eofCb, + DisconnectCallback disCb, + ClosedCallback cCb = 0, + BuffersEmptyCallback eCb = 0, + IdleCallback iCb = 0); public: - AsynchIO(const Socket& s, - ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb, - ClosedCallback cCb = 0, BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0); - void queueForDeletion(); - - void start(Poller::shared_ptr poller); - void queueReadBuffer(BufferBase* buff); - void unread(BufferBase* buff); - void queueWrite(BufferBase* buff); - void notifyPendingWrite(); - void queueWriteClose(); - bool writeQueueEmpty() { return writeQueue.empty(); } - BufferBase* getQueuedBuffer(); - -private: - ~AsynchIO(); - void readable(DispatchHandle& handle); - void writeable(DispatchHandle& handle); - void disconnected(DispatchHandle& handle); - void close(DispatchHandle& handle); + virtual void queueForDeletion() = 0; + + virtual void start(Poller::shared_ptr poller) = 0; + virtual void queueReadBuffer(BufferBase* buff) = 0; + virtual void unread(BufferBase* buff) = 0; + virtual void queueWrite(BufferBase* buff) = 0; + virtual void notifyPendingWrite() = 0; + virtual void queueWriteClose() = 0; + virtual bool writeQueueEmpty() = 0; + virtual BufferBase* getQueuedBuffer() = 0; + +protected: + // Derived class manages lifetime; must be constructed using the + // static create() method. Deletes not allowed from outside. + AsynchIO() {} + virtual ~AsynchIO() {} }; }} -- cgit v1.2.1 From 44f5710af08ee1da8fb5b1617c4583e9bd24c897 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 8 Dec 2008 02:18:03 +0000 Subject: OutputControl and subclasses: added giveReadCredit() for IO level flow control. Cluster: Set read credit limit for cluster connections. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@724233 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index f5c4607992..68e441349a 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -108,7 +108,7 @@ class AsynchIO { public: typedef AsynchIOBufferBase BufferBase; - typedef boost::function2 ReadCallback; + typedef boost::function2 ReadCallback; typedef boost::function1 EofCallback; typedef boost::function1 DisconnectCallback; typedef boost::function2 ClosedCallback; @@ -137,6 +137,7 @@ public: virtual void notifyPendingWrite() = 0; virtual void queueWriteClose() = 0; virtual bool writeQueueEmpty() = 0; + virtual void startReading() = 0; virtual BufferBase* getQueuedBuffer() = 0; protected: -- cgit v1.2.1 From fe871ca4ada184824c373595d35da3b4ae5cd535 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 6 Jan 2009 23:42:18 +0000 Subject: Work on the low level IO code: * Introduce code so that you can interrupt waiting for a handle and receive a callback that is correctly serialised with the IO callbacks for that handle git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@732177 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 68e441349a..0a2a1ca1b4 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -114,6 +114,7 @@ public: typedef boost::function2 ClosedCallback; typedef boost::function1 BuffersEmptyCallback; typedef boost::function1 IdleCallback; + typedef boost::function1 RequestCallback; // Call create() to allocate a new AsynchIO object with the specified // callbacks. This method is implemented in platform-specific code to @@ -138,6 +139,7 @@ public: virtual void queueWriteClose() = 0; virtual bool writeQueueEmpty() = 0; virtual void startReading() = 0; + virtual void requestCallback(RequestCallback) = 0; virtual BufferBase* getQueuedBuffer() = 0; protected: -- cgit v1.2.1 From ff53a558a1e9f406ffbc069b41cf4f3c75b7fe6b Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 8 Jan 2009 06:20:28 +0000 Subject: Tidied up a number of TODO items git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@732620 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 0a2a1ca1b4..c9893a8045 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -21,16 +21,14 @@ * */ -// @@TODO: TAKE THIS OUT... SHould be in posix version. -#include "DispatchHandle.h" - #include -#include +#include namespace qpid { namespace sys { class Socket; +class Poller; /* * Asynchronous acceptor: accepts connections then does a callback with the @@ -47,7 +45,7 @@ private: public: AsynchAcceptor(const Socket& s, Callback callback); ~AsynchAcceptor(); - void start(Poller::shared_ptr poller); + void start(boost::shared_ptr poller); }; /* @@ -66,7 +64,7 @@ public: // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. static AsynchConnector* create(const Socket& s, - Poller::shared_ptr poller, + boost::shared_ptr poller, std::string hostname, uint16_t port, ConnectedCallback connCb, @@ -131,7 +129,7 @@ public: public: virtual void queueForDeletion() = 0; - virtual void start(Poller::shared_ptr poller) = 0; + virtual void start(boost::shared_ptr poller) = 0; virtual void queueReadBuffer(BufferBase* buff) = 0; virtual void unread(BufferBase* buff) = 0; virtual void queueWrite(BufferBase* buff) = 0; -- cgit v1.2.1 From cf8c716aafabc56e5385c5843f335bb18e95869d Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Mon, 12 Jan 2009 23:33:12 +0000 Subject: Adding missing include git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@733967 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 1 + 1 file changed, 1 insertion(+) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index c9893a8045..6f32eb92d5 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -23,6 +23,7 @@ #include #include +#include "qpid/sys/IntegerTypes.h" namespace qpid { namespace sys { -- cgit v1.2.1 From edd6337731e417cc13f9d698bcda1d5911fcb782 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 13 Jan 2009 19:00:51 +0000 Subject: Small tidy up git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@734218 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 6f32eb92d5..6507589f2c 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -21,9 +21,10 @@ * */ +#include "qpid/sys/IntegerTypes.h" + #include #include -#include "qpid/sys/IntegerTypes.h" namespace qpid { namespace sys { -- cgit v1.2.1 From 4e66e71ceea69b37d9be26e1a35eaada0431e931 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 11 Feb 2009 17:29:42 +0000 Subject: Fix race condition with read-credit. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@743416 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 1 + 1 file changed, 1 insertion(+) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 6507589f2c..ffd4436c2a 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -139,6 +139,7 @@ public: virtual void queueWriteClose() = 0; virtual bool writeQueueEmpty() = 0; virtual void startReading() = 0; + virtual void stopReading() = 0; virtual void requestCallback(RequestCallback) = 0; virtual BufferBase* getQueuedBuffer() = 0; -- cgit v1.2.1 From b2c842c1b7361bc9754a9883e82ae360093f11a8 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Thu, 12 Mar 2009 20:55:34 +0000 Subject: Changes to build DLLs instead of static libs on Windows; primarily added decorators to exported names. Fixes QPID-1673 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@753014 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index ffd4436c2a..fb02183359 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -22,7 +22,7 @@ */ #include "qpid/sys/IntegerTypes.h" - +#include "qpid/CommonImportExport.h" #include #include @@ -45,9 +45,9 @@ private: AsynchAcceptorPrivate* impl; public: - AsynchAcceptor(const Socket& s, Callback callback); - ~AsynchAcceptor(); - void start(boost::shared_ptr poller); + QPID_COMMON_EXTERN AsynchAcceptor(const Socket& s, Callback callback); + QPID_COMMON_EXTERN ~AsynchAcceptor(); + QPID_COMMON_EXTERN void start(boost::shared_ptr poller); }; /* @@ -65,7 +65,7 @@ public: // create a correctly typed object. The platform code also manages // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. - static AsynchConnector* create(const Socket& s, + QPID_COMMON_EXTERN static AsynchConnector* create(const Socket& s, boost::shared_ptr poller, std::string hostname, uint16_t port, @@ -121,7 +121,7 @@ public: // create a correctly typed object. The platform code also manages // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. - static AsynchIO* create(const Socket& s, + QPID_COMMON_EXTERN static AsynchIO* create(const Socket& s, ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb, -- cgit v1.2.1 From 3173dac08fc9302d055151834dd7c721be1a6c27 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 22 Sep 2009 15:59:53 +0000 Subject: Make the AsynchIO API more consistent git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@817711 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index fb02183359..193d41aceb 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -108,7 +108,7 @@ class AsynchIO { public: typedef AsynchIOBufferBase BufferBase; - typedef boost::function2 ReadCallback; + typedef boost::function2 ReadCallback; typedef boost::function1 EofCallback; typedef boost::function1 DisconnectCallback; typedef boost::function2 ClosedCallback; -- cgit v1.2.1 From 9ddb1be179509be8f57753e27c4c7e9ab36ef715 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 9 Oct 2009 03:37:37 +0000 Subject: Fix memory usage error in AsynchConnector git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@823387 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 193d41aceb..419770568a 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -57,7 +57,7 @@ public: class AsynchConnector { public: typedef boost::function1 ConnectedCallback; - typedef boost::function2 FailedCallback; + typedef boost::function3 FailedCallback; // Call create() to allocate a new AsynchConnector object with the // specified poller, addressing, and callbacks. @@ -70,7 +70,7 @@ public: std::string hostname, uint16_t port, ConnectedCallback connCb, - FailedCallback failCb = 0); + FailedCallback failCb); protected: AsynchConnector() {} -- cgit v1.2.1 From 81064cb89895114f3bb40a01d75c255cd155ea58 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 16 Oct 2009 18:47:47 +0000 Subject: Rationalised AsynchConnector/Acceptor/IO to all use the same code structure git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@826032 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 419770568a..2a41f0a7d1 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -36,18 +36,13 @@ class Poller; * Asynchronous acceptor: accepts connections then does a callback with the * accepted fd */ -class AsynchAcceptorPrivate; class AsynchAcceptor { public: typedef boost::function1 Callback; -private: - AsynchAcceptorPrivate* impl; - -public: - QPID_COMMON_EXTERN AsynchAcceptor(const Socket& s, Callback callback); - QPID_COMMON_EXTERN ~AsynchAcceptor(); - QPID_COMMON_EXTERN void start(boost::shared_ptr poller); + QPID_COMMON_EXTERN static AsynchAcceptor* create(const Socket& s, Callback callback); + virtual ~AsynchAcceptor() {}; + virtual void start(boost::shared_ptr poller) = 0; }; /* -- cgit v1.2.1 From f1d40e3bacf4bf3bec9ed90b86ae3737ddc439ff Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 21 Jan 2010 06:15:06 +0000 Subject: Split out AsynchConnecter::start from constructor (like other AsynchIO classes) git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@901547 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 2a41f0a7d1..e635827d3f 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -61,11 +61,11 @@ public: // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. QPID_COMMON_EXTERN static AsynchConnector* create(const Socket& s, - boost::shared_ptr poller, std::string hostname, uint16_t port, ConnectedCallback connCb, FailedCallback failCb); + virtual void start(boost::shared_ptr poller) = 0; protected: AsynchConnector() {} -- cgit v1.2.1 From bd745085d84ee096d20fa350bb5c46e2e6d64433 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Sat, 23 Jan 2010 00:16:34 +0000 Subject: Add SSL support for Windows client and broker per QPID-1403. Adds new AsynchIO::BufferBase::squish() method that does what used to be done by in-place memmove() calls so it can be reused easily. SSL support for Windows is in: - Client: qpid/client/windows/SslConnector.cpp qpid/client/TCPConnector.{h cpp} rearranged a bit to make pieces available to SslConnector - Broker: qpid/broker/windows/SslProtocolFactory.cpp - Common: qpid/sys/windows/SslAsynchIO contains all the Schannel stuff to negotiate a session, encrypt, and decrypt data. The SslAsynchIO acts as a shim between the layer above and the "regular" AsynchIO that actually handles read/write and completions. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@902318 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index e635827d3f..4cd5d1c3fa 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -87,6 +87,13 @@ struct AsynchIOBufferBase { virtual ~AsynchIOBufferBase() {} + + void squish() { + if (dataStart != 0) { + memmove(bytes, bytes + dataStart, dataCount); + dataStart = 0; + } + } }; /* -- cgit v1.2.1 From 8f4749fd3d42d3a4fc78f6b45362d8163fd13fe6 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 27 Apr 2010 21:34:41 +0000 Subject: Added necessary #include for memmove git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@938675 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 4cd5d1c3fa..f1841639ed 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -23,6 +23,9 @@ #include "qpid/sys/IntegerTypes.h" #include "qpid/CommonImportExport.h" + +#include + #include #include @@ -90,7 +93,7 @@ struct AsynchIOBufferBase { void squish() { if (dataStart != 0) { - memmove(bytes, bytes + dataStart, dataCount); + ::memmove(bytes, bytes + dataStart, dataCount); dataStart = 0; } } -- cgit v1.2.1 From ade27a1e658534e7188f90d91e6991bafac69870 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 11 Jun 2010 08:42:37 +0000 Subject: Ensure that AsynchConnector is disassociated from Poller when aborting connection attempt due to a heartbeat timeout git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@953610 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index f1841639ed..50da8fa4fc 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -69,7 +69,7 @@ public: ConnectedCallback connCb, FailedCallback failCb); virtual void start(boost::shared_ptr poller) = 0; - + virtual void stop() {}; protected: AsynchConnector() {} virtual ~AsynchConnector() {} -- cgit v1.2.1 From 46bec4ce2ac0e8260eee6c5e2986bae0f6dafbec Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 26 May 2011 20:38:16 +0000 Subject: Refactor socket connect calls to take a string port This is used used to implement unix domain sockets - QPID-3281 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1128064 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/AsynchIO.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src/qpid/sys/AsynchIO.h') diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h index 50da8fa4fc..41f74f7ed0 100644 --- a/qpid/cpp/src/qpid/sys/AsynchIO.h +++ b/qpid/cpp/src/qpid/sys/AsynchIO.h @@ -64,8 +64,8 @@ public: // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. QPID_COMMON_EXTERN static AsynchConnector* create(const Socket& s, - std::string hostname, - uint16_t port, + const std::string& hostname, + const std::string& port, ConnectedCallback connCb, FailedCallback failCb); virtual void start(boost::shared_ptr poller) = 0; -- cgit v1.2.1