FInBunch::FInBunch( UNetConnection* InConnection, uint8* Src, int64 CountBits )
:	FNetBitReader	(InConnection->PackageMap, Src, CountBits)
,	PacketId	( 0 )
,	Next ( NULL )
,	Connection ( InConnection )
,	ChIndex ( 0 )
,	ChType ( 0 )
,	ChSequence ( 0 )
,	bOpen ( 0 )
,	bClose ( 0 )
,	bDormant ( 0 )
,	bReliable ( 0 )
,	bPartial ( 0 )
,	bPartialInitial ( 0 )
,	bPartialFinal ( 0 )
,	bHasPackageMapExports ( 0 )
{
	check(Connection);
	// Match the byte swapping settings of the connection
	SetByteSwapping(Connection->bNeedsByteSwapping);

	// Copy network version info
	ArEngineNetVer = InConnection->EngineNetworkProtocolVersion;
	ArGameNetVer = InConnection->GameNetworkProtocolVersion;

	// Crash protection: the max string size serializable on this archive 
	ArMaxSerializeSize = MAX_STRING_SERIALIZE_SIZE;
}
FOutBunch::FOutBunch( UChannel* InChannel, bool bInClose )
:	FNetBitWriter	( InChannel->Connection->PackageMap, InChannel->Connection->GetMaxSingleBunchSizeBits())
,	Next		( NULL )
,	Channel		( InChannel )
,	Time		( 0 )
,	ReceivedAck ( false )
,	ChIndex     ( InChannel->ChIndex )
,	ChType      ( InChannel->ChType )
,	ChSequence	( 0 )
,	PacketId	( 0 )
,	bOpen		( 0 )
,	bClose		( bInClose )
,	bDormant	( 0 )
,	bIsReplicationPaused	( 0 )
,	bReliable	( 0 )
,	bPartial	( 0 )
,	bPartialInitial			( 0 )
,	bPartialFinal			( 0 )
,	bHasPackageMapExports	( 0 )
,	bHasMustBeMappedGUIDs	( 0 )
{
	checkSlow(!Channel->Closing);
	checkSlow(Channel->Connection->Channels[Channel->ChIndex]==Channel);

	// Match the byte swapping settings of the connection
	SetByteSwapping(Channel->Connection->bNeedsByteSwapping);

	// Reserve channel and set bunch info.
	if( Channel->NumOutRec >= RELIABLE_BUFFER-1+bClose )
	{
		SetOverflowed(-1);
		return;
	}
}
FOutBunch::FOutBunch( UChannel* InChannel, bool bInClose )
:	FNetBitWriter	( InChannel->Connection->PackageMap, InChannel->Connection->MaxPacket*8-MAX_BUNCH_HEADER_BITS-MAX_PACKET_TRAILER_BITS-MAX_PACKET_HEADER_BITS )
,	Next		( NULL )
,	Channel		( InChannel )
,	Time		( 0 )
,	ReceivedAck ( false )
,	ChIndex     ( InChannel->ChIndex )
,	ChType      ( InChannel->ChType )
,	ChSequence	( 0 )
,	PacketId	( 0 )
,	bOpen		( 0 )
,	bClose		( bInClose )
,	bDormant	( 0 )
,	bReliable	( 0 )
,	bPartial	( 0 )
,	bPartialInitial ( 0 )
,	bPartialFinal	( 0 )
,	bHasGUIDs ( 0 )
{
	checkSlow(!Channel->Closing);
	checkSlow(Channel->Connection->Channels[Channel->ChIndex]==Channel);

	// Match the byte swapping settings of the connection
	SetByteSwapping(Channel->Connection->bNeedsByteSwapping);

	// Reserve channel and set bunch info.
	if( Channel->NumOutRec >= RELIABLE_BUFFER-1+bClose )
	{
		SetOverflowed();
		return;
	}
}