PacketWriter Struct Reference

Writing a savegame directly to a number of packets. More...

Inheritance diagram for PacketWriter:
SaveFilter

Public Member Functions

 PacketWriter (ServerNetworkGameSocketHandler *cs)
 Create the packet writer.
 ~PacketWriter ()
 Make sure everything is cleaned up.
void AppendQueue ()
 Append the current packet to the queue.
void Write (byte *buf, size_t size)
 Write a given number of bytes into the savegame.
void Finish ()
 Prepare everything to finish writing the savegame.

Data Fields

ServerNetworkGameSocketHandlercs
 Socket we are associated with.
Packetcurrent
 The packet we're currently writing to.
size_t total_size
 Total size of the compressed savegame.

Detailed Description

Writing a savegame directly to a number of packets.

Definition at line 59 of file network_server.cpp.


Constructor & Destructor Documentation

PacketWriter::PacketWriter ( ServerNetworkGameSocketHandler cs  )  [inline]

Create the packet writer.

Parameters:
cs The socket handler we're making the packets for.

Definition at line 68 of file network_server.cpp.

References ServerNetworkGameSocketHandler::savegame_mutex.

PacketWriter::~PacketWriter (  )  [inline]

Member Function Documentation

void PacketWriter::AppendQueue (  )  [inline]

Append the current packet to the queue.

Definition at line 91 of file network_server.cpp.

References Packet::next, and ServerNetworkGameSocketHandler::savegame_packets.

void PacketWriter::Write ( byte *  buf,
size_t  len 
) [inline, virtual]

Write a given number of bytes into the savegame.

Parameters:
buf The bytes to write.
len The number of bytes to write.

Implements SaveFilter.

Definition at line 104 of file network_server.cpp.

References ThreadMutex::BeginCritical(), Packet::buffer, ThreadMutex::EndCritical(), min(), PACKET_SERVER_MAP_DATA, ServerNetworkGameSocketHandler::savegame_mutex, SEND_MTU, and Packet::size.


The documentation for this struct was generated from the following file:

Generated on Thu Jan 20 22:58:43 2011 for OpenTTD by  doxygen 1.6.1