Skip to content

Commit

Permalink
Merge pull request #8 from anderssjoblom-vertex/master
Browse files Browse the repository at this point in the history
Some small adjustment to the CMakeFile.
  • Loading branch information
Chris Board authored Dec 2, 2020
2 parents 85c724a + fb0bfb1 commit 2fb57fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
cmake_minimum_required( VERSION 3.7 )
project( DataDogStatsD VERSION 1.0.0 LANGUAGES CXX )

set( CMAKE_POSITION_INDEPENDENT_CODE ON )
set( CMAKE_CXX_STANDARD 11 )

set( SOURCE
DataDogStatsD.cpp
DDEvent.cpp
Helpers.cpp )

include_directories(include)

add_library( ${PROJECT_NAME}_shared SHARED ${SOURCE} )
Expand Down
11 changes: 9 additions & 2 deletions DataDogStatsD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,11 @@ void DataDogStatsD::flush(string& udp_message)
result = ::connect(sock, (SOCKADDR *)&service, sizeof(service));
if (result != SOCKET_ERROR)
{
::send(sock, udp_message.c_str(), udp_message.length(), 0);
int bytes_written= ::send(sock, udp_message.c_str(), udp_message.length(), 0);
// What to do if the message wasn't fully sent?
if (bytes_written < (int)udp_message.length()) {
}

closesocket(sock);
WSACleanup();
}
Expand All @@ -573,7 +577,10 @@ void DataDogStatsD::flush(string& udp_message)

connect(udp_socket, (struct sockaddr *) &serv_addr, sizeof(serv_addr));

write(udp_socket, udp_message.c_str(), udp_message.length());
ssize_t bytes_written= write(udp_socket, udp_message.c_str(), udp_message.length());
// What to do if the message wasn't fully sent?
if (bytes_written < (ssize_t)udp_message.length()) {
}

close(udp_socket);
#endif
Expand Down

0 comments on commit 2fb57fe

Please sign in to comment.