Public Member Functions | Data Fields

# PacketWriter Struct Reference

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

Inheritance diagram for PacketWriter:

## 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
ServerNetworkGameSocketHandler * | cs
| Socket we are associated with.
Packet * | current
| 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 56 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 65 of file network_server.cpp.

References ThreadMutex::New(), and ServerNetworkGameSocketHandler::savegame_mutex.

PacketWriter::~PacketWriter | ( |  | ) | `[inline]`

Make sure everything is cleaned up.

Definition at line 71 of file network_server.cpp.

References ThreadMutex::BeginCritical(), ThreadMutex::EndCritical(), ServerNetworkGameSocketHandler::savegame, and ServerNetworkGameSocketHandler::savegame_mutex.

## Member Function Documentation

void PacketWriter::AppendQueue | ( |  | ) | `[inline]`

Append the current packet to the queue.

Definition at line 87 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 100 of file network_server.cpp.

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

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

- src/network/network_server.cpp