Glimesh / janus-ftl-plugin

A plugin for the Janus WebRTC gateway to enable relaying of audio/video streams utilizing Mixer's FTL (Faster-Than-Light) protocol.
https://hayden.fyi/posts/2020-08-03-Faster-Than-Light-protocol-engineering-notes.html
GNU Affero General Public License v3.0
46 stars 11 forks source link

Don't ignore return values of `write(...)` #54

Open haydenmc opened 3 years ago

haydenmc commented 3 years ago

We're seeing some warnings, and we ought to address them.

../src/FtlClient.cpp: In member function ‘void FtlClient::RelayPacket(RtpRelayPacket)’:
../src/FtlClient.cpp:108:14: error: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
  108 |         write(mediaSocketHandle, packet.rtpPacketPayload->data(), packet.rtpPacketPayload->size());
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/FtlClient.cpp: In member function ‘void FtlClient::sendControlMessage(std::string)’:
../src/FtlClient.cpp:416:10: error: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
  416 |     write(controlSocketHandle, message.c_str(), message.size());
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
haydenmc commented 3 years ago

Added a workaround for the compiler warnings in #60, but we ought to check for bad write return values and respond appropriately. Leaving this issue open to track.