equal
deleted
inserted
replaced
66 void CHttpRequestBatcher::SendRequestImmediatelyL(const TDesC8& aBuffer) |
66 void CHttpRequestBatcher::SendRequestImmediatelyL(const TDesC8& aBuffer) |
67 { |
67 { |
68 #if defined (_DEBUG) && defined (_LOGGING) |
68 #if defined (_DEBUG) && defined (_LOGGING) |
69 __FLOG_0(_T8("!! Send the first request i.e. not batching")); |
69 __FLOG_0(_T8("!! Send the first request i.e. not batching")); |
70 #endif |
70 #endif |
71 |
71 |
72 // This function will be called when the request is sent first time on a newly |
|
73 // opened connection. So no need to mark it as sending... |
|
74 iOutputStream->SendDataReqL(aBuffer); |
72 iOutputStream->SendDataReqL(aBuffer); |
75 } |
73 } |
76 |
74 |
77 void CHttpRequestBatcher::SendRequestsBatchedL(const TDesC8& aBuffer) |
75 void CHttpRequestBatcher::SendRequestsBatchedL(const TDesC8& aBuffer) |
78 { |
76 { |
79 if(iSendingRequest) |
|
80 { |
|
81 // The batcher is not having enough data [batching buffer size] size |
|
82 // available. It would have been requested the supplier to provide more data. |
|
83 // By the time the timer would have been expired and the batcher would have been sent the data. |
|
84 // Before the notificaiton of the confirmation of data is sent the supplier can give more data |
|
85 // to the batcher which will make the batcher to send the data again and double RSocket :: Send |
|
86 // will cause the panic.. At this point the excess data will be empty |
|
87 iExcessData.Set(aBuffer); |
|
88 return; // Dont send the data here. Send once the confirmation of previous send has received |
|
89 } |
|
90 StartTimer(); |
77 StartTimer(); |
91 |
78 |
92 BatchRequestsL(aBuffer); |
79 BatchRequestsL(aBuffer); |
93 } |
80 } |
94 |
81 |
117 #if defined (_DEBUG) && defined (_LOGGING) |
104 #if defined (_DEBUG) && defined (_LOGGING) |
118 __FLOG_0(_T8("!! Buffer has been filled - cancel timer and send batched requests now")); |
105 __FLOG_0(_T8("!! Buffer has been filled - cancel timer and send batched requests now")); |
119 #endif |
106 #endif |
120 |
107 |
121 // Send the request with a filled-up buffer |
108 // Send the request with a filled-up buffer |
122 iSendingRequest = ETrue; |
|
123 iOutputStream->SendDataReqL(iDataToSend); |
109 iOutputStream->SendDataReqL(iDataToSend); |
124 |
110 |
125 // Save the excess data from this request |
111 // Save the excess data from this request |
126 iExcessData.Set(aBuffer.Mid(pos)); |
112 iExcessData.Set(aBuffer.Mid(pos)); |
127 } |
113 } |
200 * Methods from MOutputStreamObserver |
186 * Methods from MOutputStreamObserver |
201 */ |
187 */ |
202 |
188 |
203 void CHttpRequestBatcher::SendDataCnfL() |
189 void CHttpRequestBatcher::SendDataCnfL() |
204 { |
190 { |
205 iSendingRequest = EFalse; // Confirmation of data send has received. reset the flag |
|
206 // If this is the first request send a confirmation to the observer that the data |
191 // If this is the first request send a confirmation to the observer that the data |
207 // has been sent and then set the function pointer to the SendRequestBatched() method. |
192 // has been sent and then set the function pointer to the SendRequestBatched() method. |
208 if (iFuncPtr == &CHttpRequestBatcher::SendRequestImmediatelyL) |
193 if (iFuncPtr == &CHttpRequestBatcher::SendRequestImmediatelyL) |
209 { |
194 { |
210 #if defined (_DEBUG) && defined (_LOGGING) |
195 #if defined (_DEBUG) && defined (_LOGGING) |
248 #endif |
233 #endif |
249 |
234 |
250 // It's possible that the excess data is larger than the maximum allowable size of the buffer in |
235 // It's possible that the excess data is larger than the maximum allowable size of the buffer in |
251 // which case this excess data is used to fill up another buffer and a request made. |
236 // which case this excess data is used to fill up another buffer and a request made. |
252 iDataToSend.Append(iExcessData.Left(iMaxBufferSize)); |
237 iDataToSend.Append(iExcessData.Left(iMaxBufferSize)); |
253 iSendingRequest = ETrue; |
|
254 iOutputStream->SendDataReqL(iDataToSend); |
238 iOutputStream->SendDataReqL(iDataToSend); |
255 iExcessData.Set(iExcessData.Mid(iMaxBufferSize)); |
239 iExcessData.Set(iExcessData.Mid(iMaxBufferSize)); |
256 } |
240 } |
257 else |
241 else |
258 { |
242 { |
304 #if defined (_DEBUG) && defined (_LOGGING) |
288 #if defined (_DEBUG) && defined (_LOGGING) |
305 __FLOG_0(_T8("!! Timer has completed before buffer has been filled - send request now")); |
289 __FLOG_0(_T8("!! Timer has completed before buffer has been filled - send request now")); |
306 #endif |
290 #endif |
307 |
291 |
308 // Timer has completed before the buffer has been filled, therefore send the request now. |
292 // Timer has completed before the buffer has been filled, therefore send the request now. |
309 iSendingRequest = ETrue; |
|
310 iOutputStream->SendDataReqL(iDataToSend); |
293 iOutputStream->SendDataReqL(iDataToSend); |
311 } |
294 } |
312 iTimerCompleted = ETrue; |
295 iTimerCompleted = ETrue; |
313 } |
296 } |
314 |
297 |
334 } |
317 } |
335 |
318 |
336 void CHttpRequestBatcher::SetTCPCorking(TBool aValue ) |
319 void CHttpRequestBatcher::SetTCPCorking(TBool aValue ) |
337 { |
320 { |
338 if (iOutputStream) |
321 if (iOutputStream) |
339 { |
322 { |
340 iOutputStream->SetTCPCorking(aValue); |
323 iOutputStream->SetTCPCorking(aValue); |
341 } |
324 } |
342 } |
325 } |
343 |
326 |
344 |
327 |