Changeset 23:e6c4c31ce833 in xplcommon
- Timestamp:
- 01/02/13 06:50:19 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/xplcommon/win32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/win32/LocalAcceptor.cc
r22 r23 40 40 LocalAcceptor::LocalAcceptor(LocalServerSocketBase* socket, const char* name) : 41 41 Completer(socket), 42 socket(*socket),43 42 accepted(false) 44 43 { … … 58 57 } 59 58 59 LocalServerSocketBase& socket = getServerSocket(); 60 60 if (!socket.createNamedPipe(path)) { 61 61 return false; -
src/xplcommon/win32/LocalAcceptor.h
r22 r23 52 52 private: 53 53 /** 54 * The local server socket for which we are accepting connections.55 */56 LocalServerSocketBase& socket;57 58 /**59 54 * The path of the pipe to accept. 60 55 */ … … 71 66 */ 72 67 LocalAcceptor(LocalServerSocketBase* socket, const char* name); 68 69 /** 70 * Get the socket. 71 * 72 * It returns the overlappable from the Completer part, knowing 73 * that it must be a LocalServerSocketBase. 74 */ 75 LocalServerSocketBase& getServerSocket() const; 73 76 74 77 public: … … 130 133 //------------------------------------------------------------------------------ 131 134 135 inline LocalServerSocketBase& LocalAcceptor::getServerSocket() const 136 { 137 return static_cast<LocalServerSocketBase&>(overlappable); 138 } 139 140 //------------------------------------------------------------------------------ 141 132 142 inline LocalSocket* LocalAcceptor::getSocket(Waiter* waiter, 133 143 size_t readingCapacity, … … 136 146 if (!accepted) return 0; 137 147 138 LocalSocket* s = new LocalSocket(waiter, socket.releaseHandle(),148 LocalSocket* s = new LocalSocket(waiter, getServerSocket().releaseHandle(), 139 149 readingCapacity, writingCapacity); 140 150 accepted = false; 141 151 return s; 142 152 } 153 143 154 //------------------------------------------------------------------------------ 144 155 … … 146 157 size_t writingCapacity) 147 158 { 148 return getSocket(socket.waiter, readingCapacity, writingCapacity); 159 return getSocket(getServerSocket().waiter, 160 readingCapacity, writingCapacity); 149 161 } 150 162 … … 153 165 inline const ::xplcommon::Failable& LocalAcceptor::getFailable() const 154 166 { 155 return socket;167 return overlappable; 156 168 } 157 169 … … 160 172 inline ::xplcommon::Failable& LocalAcceptor::getFailable() 161 173 { 162 return socket;174 return overlappable; 163 175 } 164 176 -
src/xplcommon/win32/ReadingBuffer.cc
r22 r23 53 53 } 54 54 55 BufferedStream& stream = getStream(); 55 56 ssize_t numRead = stream.read(getData(), getCapacity(), overlapped); 56 57 if (numRead<0) { -
src/xplcommon/win32/StreamBuffer.h
r21 r23 52 52 protected: 53 53 /** 54 * The buffered stream this stream buffer belongs to.55 */56 BufferedStream& stream;57 58 protected:59 /**60 54 * Construct the stream buffer with the given capacity and for the 61 55 * given stream. 62 56 */ 63 57 StreamBuffer(size_t capacity, BufferedStream* stream); 58 59 /** 60 * Get the stream. 61 * 62 * This just casts the overlappable of the Completer part knowing 63 * that it must be a BufferedStream 64 */ 65 BufferedStream& getStream() const; 64 66 65 67 private: … … 83 85 inline StreamBuffer::StreamBuffer(size_t capacity, BufferedStream* stream) : 84 86 Buffer(capacity), 85 Completer(stream), 86 stream(*stream) 87 Completer(stream) 87 88 { 89 } 90 91 //------------------------------------------------------------------------------ 92 93 inline BufferedStream& StreamBuffer::getStream() const 94 { 95 return static_cast<BufferedStream&>(overlappable); 88 96 } 89 97 … … 92 100 inline const ::xplcommon::Failable& StreamBuffer::getFailable() const 93 101 { 94 return stream;102 return overlappable; 95 103 } 96 104 … … 99 107 inline ::xplcommon::Failable& StreamBuffer::getFailable() 100 108 { 101 return stream;109 return overlappable; 102 110 } 103 111 -
src/xplcommon/win32/WritingBuffer.cc
r22 r23 51 51 } 52 52 53 BufferedStream& stream = getStream(); 53 54 result = stream.write(getData(), getLength(), overlapped); 54 55 if (result) {
Note:
See TracChangeset
for help on using the changeset viewer.