|
|
@ -414,6 +414,7 @@ void Netchan_ClearFragbufs( fragbuf_t **ppbuf ) |
|
|
|
while( buf ) |
|
|
|
while( buf ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
n = buf->next; |
|
|
|
n = buf->next; |
|
|
|
|
|
|
|
Mem_Free( buf->frag_message_buf ); |
|
|
|
Mem_Free( buf ); |
|
|
|
Mem_Free( buf ); |
|
|
|
buf = n; |
|
|
|
buf = n; |
|
|
|
} |
|
|
|
} |
|
|
@ -535,12 +536,13 @@ Netchan_AllocFragbuf |
|
|
|
|
|
|
|
|
|
|
|
============================== |
|
|
|
============================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fragbuf_t *Netchan_AllocFragbuf( void ) |
|
|
|
fragbuf_t *Netchan_AllocFragbuf( int fragment_size ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fragbuf_t *buf; |
|
|
|
fragbuf_t *buf; |
|
|
|
|
|
|
|
|
|
|
|
buf = (fragbuf_t *)Mem_Calloc( net_mempool, sizeof( fragbuf_t )); |
|
|
|
buf = (fragbuf_t *)Mem_Calloc( net_mempool, sizeof( fragbuf_t )); |
|
|
|
MSG_Init( &buf->frag_message, "Frag Message", buf->frag_message_buf, sizeof( buf->frag_message_buf )); |
|
|
|
buf->frag_message_buf = (byte *)Mem_Calloc( net_mempool, fragment_size ); |
|
|
|
|
|
|
|
MSG_Init( &buf->frag_message, "Frag Message", buf->frag_message_buf, fragment_size ); |
|
|
|
|
|
|
|
|
|
|
|
return buf; |
|
|
|
return buf; |
|
|
|
} |
|
|
|
} |
|
|
@ -736,7 +738,7 @@ static void Netchan_CreateFragments_( netchan_t *chan, sizebuf_t *msg ) |
|
|
|
bytes = Q_min( remaining, chunksize ); |
|
|
|
bytes = Q_min( remaining, chunksize ); |
|
|
|
remaining -= bytes; |
|
|
|
remaining -= bytes; |
|
|
|
|
|
|
|
|
|
|
|
buf = Netchan_AllocFragbuf(); |
|
|
|
buf = Netchan_AllocFragbuf( bytes ); |
|
|
|
buf->bufferid = bufferid++; |
|
|
|
buf->bufferid = bufferid++; |
|
|
|
|
|
|
|
|
|
|
|
// Copy in data
|
|
|
|
// Copy in data
|
|
|
@ -803,7 +805,7 @@ fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, qboolean allocate |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
// create new entry
|
|
|
|
// create new entry
|
|
|
|
pnewbuf = Netchan_AllocFragbuf(); |
|
|
|
pnewbuf = Netchan_AllocFragbuf( NET_MAX_FRAGMENT ); |
|
|
|
pnewbuf->bufferid = id; |
|
|
|
pnewbuf->bufferid = id; |
|
|
|
Netchan_AddBufferToList( pplist, pnewbuf ); |
|
|
|
Netchan_AddBufferToList( pplist, pnewbuf ); |
|
|
|
|
|
|
|
|
|
|
@ -894,7 +896,7 @@ void Netchan_CreateFileFragmentsFromBuffer( netchan_t *chan, const char *filenam |
|
|
|
{ |
|
|
|
{ |
|
|
|
send = Q_min( remaining, chunksize ); |
|
|
|
send = Q_min( remaining, chunksize ); |
|
|
|
|
|
|
|
|
|
|
|
buf = Netchan_AllocFragbuf(); |
|
|
|
buf = Netchan_AllocFragbuf( send ); |
|
|
|
buf->bufferid = bufferid++; |
|
|
|
buf->bufferid = bufferid++; |
|
|
|
|
|
|
|
|
|
|
|
// copy in data
|
|
|
|
// copy in data
|
|
|
@ -1013,7 +1015,7 @@ int Netchan_CreateFileFragments( netchan_t *chan, const char *filename ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
send = Q_min( remaining, chunksize ); |
|
|
|
send = Q_min( remaining, chunksize ); |
|
|
|
|
|
|
|
|
|
|
|
buf = Netchan_AllocFragbuf(); |
|
|
|
buf = Netchan_AllocFragbuf( send ); |
|
|
|
buf->bufferid = bufferid++; |
|
|
|
buf->bufferid = bufferid++; |
|
|
|
|
|
|
|
|
|
|
|
// copy in data
|
|
|
|
// copy in data
|
|
|
|