[Freeciv-Dev] patch: dynamically allocate buffers in connection struct (
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
The connection struct is quite large (about 80k), because it contains
the buffers used for sending and receiving data (10*MAX_LEN_PACKET).
The server contains 50 of these for new connections, which is wasteful
for servers which only receive one or few actual connections.
One possibility would be to allocate connection structs dynamically,
and store in eg genlist/speclist. May do this later anyway, but
another issue is that the client uses some connection structs to keep
track of limited data about other clients (capability strings etc).
(May use these even more in future with multi-connects.) In this case
send/receive buffers are not used at all, since in this case the
connection structs don't represent real connections. Could have eg
conn_info struct with reduced information, but using normal connection
struct allows easy and natural re-use of pplayer->conn field (and
planned future connection lists in game and player structs), rather
than client and server using separate fields.
This patch addresses these issues nicely by making the buffer parts
of the connection struct dynamically allocated. This avoids memory
waste, while allowing the non-allocated parts of the struct to be
conveniently used by both server and client according to their
separate needs.
This patch requires very recent CVS version, since it modifies the
new common/connection module I just checked in.
There were some subtle bugs in earlier versions of this patch (before
I got around to submitting it), so some testing might be good ;-)
-- David
conn_alloc_bufs1c.diff.gz
Description: GNU Zip compressed data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] patch: dynamically allocate buffers in connection struct (PR#473),
David Pfitzner <=
|
|