saltysystems / enet

ENet implementation in Erlang/OTP
Apache License 2.0
9 stars 0 forks source link

Decompress #8

Closed cmdrk closed 1 year ago

cmdrk commented 1 year ago

PR adds zlib compression support. A new configuration option is added to enet_host, compression_mode. e.g.:

Options = [ {peer_limit, ?PEER_LIMIT}, {channel_limit, ?CHANNEL_LIMIT}, {compression_mode, zlib} ], 
Handler = {my_enet_handler_module, start, []}, 
enet:start_host(?ENET_PORT, Handler, Options),

This assumes that the host will use the same compression to send and receive packets. If there's a demonstrable use case we could later change it to have compress_fun and decompress_fun and have the consumer of the library supply the (de)compression functions.