protected void OutputResponse(DataStorage dts)
 {
     int valPos = 0, valLeft = 0;
     RefCountPtr* valData = null;
     for (var oe = _clist; oe != null; )
     {
         var ds = dts.GetSegmentToRead(iBigBlockSize);
         fixed (byte* bp = ds.Buffer)
         {
             byte* cp = bp + ds.Offset + ds.Count, ep = cp + ds.Size;
             for (; oe != null; oe = oe->next)
             {
                 if (valLeft == 0)
                 {
                     if (SkipResponse(oe)) continue;
                     // write response header information.
                     var xp = WritePacket(oe, cp, ep);
                     // check for boundary crossing in buffer.
                     if (xp == cp) break;
                     cp = xp;
                     if (oe->status != iSuccess) continue;
                     valLeft = oe->ValSize;
                     if (valLeft == 0) continue;
                     valData = oe->val_addr;
                     // quick path, small value copy to output.
                     if (valLeft < iBigBlockSize)
                     {
                         var bleft = (int)(ep - cp);
                         if (bleft >= valLeft)
                         {
                             _memcopy(cp, _skip(valData, 0), valLeft);
                             cp += valLeft;
                             valLeft = 0;
                             continue;
                         }
                     }
                     valPos = 0;
                 }
                 // copy value bytes into the buffer.
                 do
                 {
                     int dleft = (int)(ep - cp), sleft = iBigBlockSize - valPos;
                     if (sleft > valLeft) sleft = valLeft;
                     if (dleft <= sleft)
                     {
                         _memcopy(cp, _skip(valData, valPos), dleft);
                         valLeft -= dleft;
                         valPos += dleft;
                         cp += dleft;
                         break;
                     }
                     _memcopy(cp, _skip(valData, valPos), sleft);
                     cp += sleft;
                     valLeft -= sleft;
                     if (valLeft == 0) break;
                     valData = valData->Next;
                     valPos = 0;
                 } while (true);
                 // may need to switch the page.
                 if (valLeft != 0)
                     break;
             }
             // "commit" generated memcached responses.
             var bytes = (int)(cp - bp) - ds.Offset;
             if (bytes > 0)
                 dts.ReadCommit(bytes);
         }
     }
 }