* Steve Huston <[EMAIL PROTECTED]> [08/28/08 06:38]: > That would be helpful - I am hoping to have the windows client > completed in the next week or so, so let's work together - you can > either send me patches against windows2 or make another branch in the > git repo.
Sounds good. Here's the stuff I did so far from git diff against windows2, let me know if you'd like to me to work on anything else with the client. I'm not sure if any of these changes are how you had intended on it working, these are just quick fixes I did while trying to get it working (when I started on this I for some reason thought that the client was done and working or I would have contacted you beforehand). Changes: * Removed const and subsequent const cast from overlapped() * Moved the OVERLAPPED cast back to AsynchResult so it uses the correct offset * Changed WSABUF to protected, and moved initialization to read and write results. AsynchWriteResult bufs were getting set to the end of the data and sending uninitialized memory. Matt
diff --git a/qpid/cpp/src/qpid/sys/windows/AsynchIO.cpp b/qpid/cpp/src/qpid/sys/windows/AsynchIO.cpp index 1eaa716..f875409 100644 --- a/qpid/cpp/src/qpid/sys/windows/AsynchIO.cpp +++ b/qpid/cpp/src/qpid/sys/windows/AsynchIO.cpp @@ -116,8 +116,10 @@ void AsynchAcceptResult::success(size_t /*bytesTransferred*/) { } void AsynchAcceptResult::failure(int status) { +/* if (status != WSA_OPERATION_ABORTED) ; +*/ delete this; } diff --git a/qpid/cpp/src/qpid/sys/windows/AsynchIoResult.h b/qpid/cpp/src/qpid/sys/windows/AsynchIoResult.h index 5ab2ea5..2c5fc64 100644 --- a/qpid/cpp/src/qpid/sys/windows/AsynchIoResult.h +++ b/qpid/cpp/src/qpid/sys/windows/AsynchIoResult.h @@ -46,7 +46,10 @@ namespace sys { */ class AsynchResult : private OVERLAPPED { public: - LPOVERLAPPED overlapped(void) const { return (LPOVERLAPPED)this; }; + LPOVERLAPPED overlapped(void) { return this; }; + static AsynchResult* from_overlapped(LPOVERLAPPED ol) { + return static_cast<AsynchResult*>(ol); + } virtual void success (size_t bytesTransferred) { bytes = bytesTransferred; status = 0; @@ -111,19 +114,16 @@ protected: protected: AsynchIoResult(AsynchIO *factory, AsynchIO::BufferBase *buff, size_t length) - : factory(factory), iobuff(buff), requested(length) { - wsabuf.buf = buff->bytes + buff->dataCount; - wsabuf.len = length; - } + : factory(factory), iobuff(buff), requested(length) {} virtual ~AsynchIoResult() {} virtual void complete(void) = 0; + WSABUF wsabuf; private: AsynchIO *factory; AsynchIO::BufferBase *iobuff; size_t requested; // Number of bytes in original I/O request - WSABUF wsabuf; }; class AsynchReadResult : public AsynchIoResult { @@ -139,7 +139,10 @@ public: AsynchReadResult(AsynchIO *factory, AsynchIO::BufferBase *buff, size_t length) - : AsynchIoResult(factory, buff, length) {} + : AsynchIoResult(factory, buff, length) { + wsabuf.buf = buff->bytes + buff->dataCount; + wsabuf.len = length; + } }; @@ -158,7 +161,10 @@ public: AsynchWriteResult(AsynchIO *factory, AsynchIO::BufferBase *buff, size_t length) - : AsynchIoResult(factory, buff, length) {} + : AsynchIoResult(factory, buff, length) { + wsabuf.buf = buff->bytes; + wsabuf.len = length; + } }; }} diff --git a/qpid/cpp/src/qpid/sys/windows/IocpPoller.cpp b/qpid/cpp/src/qpid/sys/windows/IocpPoller.cpp index e904402..3c9129e 100644 --- a/qpid/cpp/src/qpid/sys/windows/IocpPoller.cpp +++ b/qpid/cpp/src/qpid/sys/windows/IocpPoller.cpp @@ -155,7 +155,7 @@ Poller::Event Poller::wait(Duration timeout) { timeoutMs)) { // Dequeued a successful completion. Downcast the OVERLAPPED // pointer to an AsynchIoResult and call the completion handler. - result = reinterpret_cast<AsynchResult *>(overlapped); + result = AsynchResult::from_overlapped(overlapped); result->success (static_cast<size_t>(numTransferred)); } else {