diff options
Diffstat (limited to 'src/stable/clientbuf.cpp')
-rw-r--r-- | src/stable/clientbuf.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/src/stable/clientbuf.cpp b/src/stable/clientbuf.cpp index c6b310f..8c4afc4 100644 --- a/src/stable/clientbuf.cpp +++ b/src/stable/clientbuf.cpp | |||
@@ -175,19 +175,16 @@ void Bu::ClientBuf::ClientAccess::close() | |||
175 | 175 | ||
176 | Bu::size Bu::ClientBuf::ClientAccess::read( void *pBufRaw, size iBytes ) | 176 | Bu::size Bu::ClientBuf::ClientAccess::read( void *pBufRaw, size iBytes ) |
177 | { | 177 | { |
178 | Bu::println("ClientAccess::read( ptr, %1 )").arg( iBytes ); | ||
179 | char *pBuf = (char *)pBufRaw; | 178 | char *pBuf = (char *)pBufRaw; |
180 | Bu::MutexLocker l( mAccess ); | 179 | Bu::MutexLocker l( mAccess ); |
181 | // Read from QueueBuf first | 180 | // Read from QueueBuf first |
182 | Bu::size ps = qbPeek.read( pBuf, iBytes ); | 181 | Bu::size ps = qbPeek.read( pBuf, iBytes ); |
183 | Bu::println("ClientAccess::read: attempted qbPeek, got %1\n>%2<").arg( ps ).arg( Bu::String(pBuf, ps) ); | ||
184 | iBytes -= ps; | 182 | iBytes -= ps; |
185 | pBuf += ps; | 183 | pBuf += ps; |
186 | // Request space left? Try the client | 184 | // Request space left? Try the client |
187 | if( iBytes > 0 ) | 185 | if( iBytes > 0 ) |
188 | { | 186 | { |
189 | ps += rBuf.accClientFiltered.read( pBuf, iBytes ); | 187 | ps += rBuf.accClientFiltered.read( pBuf, iBytes ); |
190 | Bu::println("ClientAccess::read: attempted completion from socket buffer, got %1\n>%2<").arg( ps ).arg( Bu::String(pBuf, ps) ); | ||
191 | } | 188 | } |
192 | return ps; | 189 | return ps; |
193 | } | 190 | } |
@@ -195,26 +192,22 @@ Bu::size Bu::ClientBuf::ClientAccess::read( void *pBufRaw, size iBytes ) | |||
195 | Bu::size Bu::ClientBuf::ClientAccess::peek( void *pData, int iBytes, | 192 | Bu::size Bu::ClientBuf::ClientAccess::peek( void *pData, int iBytes, |
196 | int iOffset ) | 193 | int iOffset ) |
197 | { | 194 | { |
198 | Bu::println("ClientAccess::peek( ptr, %1, %2 )").arg( iBytes ).arg( iOffset ); | ||
199 | Bu::MutexLocker l( mAccess ); | 195 | Bu::MutexLocker l( mAccess ); |
200 | // Do we have enough data in the peek buffer to handle this? | 196 | // Do we have enough data in the peek buffer to handle this? |
201 | if( qbPeek.getSize() < iBytes+iOffset ) | 197 | if( qbPeek.getSize() < iBytes+iOffset ) |
202 | { | 198 | { |
203 | Bu::println("ClientAccess::peek: Insufficient buffered (have %1b, need %2b)").arg( qbPeek.getSize() ).arg( iBytes+iOffset ); | ||
204 | // Nope, make an attempt to fill it in. | 199 | // Nope, make an attempt to fill it in. |
205 | int nDiff = (iBytes+iOffset)-qbPeek.getSize(); | 200 | int nDiff = (iBytes+iOffset)-qbPeek.getSize(); |
206 | // We have to make our own buffer, since iBytes+nOffeset could be bigger | 201 | // We have to make our own buffer, since iBytes+nOffeset could be bigger |
207 | // than pData. | 202 | // than pData. |
208 | char *pTmp = new char[nDiff]; | 203 | char *pTmp = new char[nDiff]; |
209 | Bu::size ps = rBuf.accClientFiltered.read( pTmp, nDiff ); | 204 | Bu::size ps = rBuf.accClientFiltered.read( pTmp, nDiff ); |
210 | Bu::println("ClientAccess::peek: Tried to fill buffer, read %1 of needed %2\n>%3<").arg( ps ).arg( nDiff ).arg( Bu::String(pTmp, ps) ); | ||
211 | if( ps > 0 ) | 205 | if( ps > 0 ) |
212 | { | 206 | { |
213 | // Add the data read to the peek buffer. | 207 | // Add the data read to the peek buffer. |
214 | qbPeek.write( pTmp, ps ); | 208 | qbPeek.write( pTmp, ps ); |
215 | } | 209 | } |
216 | delete[] pTmp; | 210 | delete[] pTmp; |
217 | Bu::println("ClientAccess::peek: buffer left with %1").arg( qbPeek.getSize() ); | ||
218 | } | 211 | } |
219 | 212 | ||
220 | return qbPeek.peek( pData, iBytes, iOffset ); | 213 | return qbPeek.peek( pData, iBytes, iOffset ); |
@@ -234,7 +227,6 @@ Bu::size Bu::ClientBuf::ClientAccess::tell() | |||
234 | 227 | ||
235 | void Bu::ClientBuf::ClientAccess::seek( Bu::size offset ) | 228 | void Bu::ClientBuf::ClientAccess::seek( Bu::size offset ) |
236 | { | 229 | { |
237 | Bu::println("ClientAccess::seek( %1 )").arg( offset ); | ||
238 | Bu::MutexLocker l( mAccess ); | 230 | Bu::MutexLocker l( mAccess ); |
239 | // For this type of stream seek is basically a destructive skip. It's like | 231 | // For this type of stream seek is basically a destructive skip. It's like |
240 | // reading the data but with no output buffer. Let's remove data from the | 232 | // reading the data but with no output buffer. Let's remove data from the |
@@ -242,7 +234,6 @@ void Bu::ClientBuf::ClientAccess::seek( Bu::size offset ) | |||
242 | if( qbPeek.getSize() > 0 ) | 234 | if( qbPeek.getSize() > 0 ) |
243 | { | 235 | { |
244 | Bu::size amount = Bu::buMin( qbPeek.getSize(), offset ); | 236 | Bu::size amount = Bu::buMin( qbPeek.getSize(), offset ); |
245 | Bu::println("ClientAccess::seek: buffered: %1, amount: %2").arg( qbPeek.getSize() ).arg( amount ); | ||
246 | qbPeek.seek( amount ); | 237 | qbPeek.seek( amount ); |
247 | offset -= amount; | 238 | offset -= amount; |
248 | } | 239 | } |
@@ -250,7 +241,6 @@ void Bu::ClientBuf::ClientAccess::seek( Bu::size offset ) | |||
250 | // If there's offset left, then apply it to the underlying stream | 241 | // If there's offset left, then apply it to the underlying stream |
251 | if( offset > 0 ) | 242 | if( offset > 0 ) |
252 | { | 243 | { |
253 | Bu::println("ClientAccess::seek: seeking remaining %1 in socket buffer").arg( offset ); | ||
254 | rBuf.accClientFiltered.seek( offset ); | 244 | rBuf.accClientFiltered.seek( offset ); |
255 | } | 245 | } |
256 | } | 246 | } |