From: Alan T. DeKok Date: Wed, 12 Jul 2017 15:43:12 +0000 (-0400) Subject: don't call write() if there's no data in the message X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd63c220d2bdfd85068c73e500997a8c0d48b6ca;p=thirdparty%2Ffreeradius-server.git don't call write() if there's no data in the message --- diff --git a/src/lib/io/network.c b/src/lib/io/network.c index 4e21871fcbd..3088339cacf 100644 --- a/src/lib/io/network.c +++ b/src/lib/io/network.c @@ -762,6 +762,14 @@ static void fr_network_post_event(UNUSED fr_event_list_t *el, UNUSED struct time listen = cd->listen; + /* + * No data to write to the socket, so we skip it. + */ + if (!cd->m.data_size) { + fr_message_done(&cd->m); + continue; + } + /* * The write function is responsible for ensuring * that NAKs are not written to the network.