All pastes #333624 Raw Edit

Anonymous

public text v1 · immutable
#333624 ·published 2007-01-31 00:44 UTC
rendered paste body
<sabor> so if absOff=5000k he reads 2000k, then again the same 2000k adn then the remaining 1000k which is again the same ;)
<T`> hmm no
<T`> so lets say absOff = 5k
<T`> you ar3e a moron and u dont start logging until many hours..
<T`> then u start logging.. read(buf, len=2k, offset=0)
<T`> this is the first read.. 
* sabor . o O ( so much for exploding brains =)
<T`> damn.. u stil here?? ur supposed to have shot urself by now fdamnit
* T` always  screwing up my evil plans.. grr
<T`> well.. so the read goes and asks for 2k bytes from offset 0
<T`> we see offset < 5k - (BUFFER_SIZE=2k)
<T`> so we do offset = (absOff - 2k)
<T`> and read from offset 3k to 5k.. and return
<T`> in the first read, i update an open handle's data structure with the latest offset .. 3k
<T`> so when you do next.. 2k read
<T`> you are trying to read... offset: 2k+3k, length: 2k
<T`> so then it will block until you get enough data
<T`> makes sense?
<T`>    Log_GetBufferBlocking(data, &length, &absOffset, TRUE);
<T`>    if (!handleData->offsetInit) {
<T`>       handleData->startOffset = absOffset;
<T`>       handleData->offsetInit = 1;
<T`>    }
<T`> oops.. and in the beginning i have:
<T`>    uint32 absOffset = handleData->startOffset + offset;
<T`> Log_GetBufferBlocking will immediately return if there is any data.. and it will overwrite absOffset with latest starting offset of the log buffer