]> granicus.if.org Git - pdns/commitdiff
Use `sendSizeAndMsgWithTimeout()` in Remote Logger (protobuf)
authorRemi Gacogne <remi.gacogne@powerdns.com>
Sun, 5 Feb 2017 11:13:54 +0000 (12:13 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 6 Feb 2017 15:22:37 +0000 (16:22 +0100)
pdns/remote_logger.cc

index de77e78c2e8d2361d0a5f6f3edb92dd2d86f7329..07ab13e13319db2dbe699e886057db1d74b373d8 100644 (file)
@@ -49,10 +49,8 @@ void RemoteLogger::worker()
     }
 
     try {
-      uint16_t len = data.length();
-      len = htons(len);
-      writen2WithTimeout(d_socket, &len, sizeof(len), (int) d_timeout);
-      writen2WithTimeout(d_socket, data.c_str(), data.length(), (int) d_timeout);
+      uint16_t len = static_cast<uint16_t>(data.length());
+      sendSizeAndMsgWithTimeout(d_socket, len, data.c_str(), static_cast<int>(d_timeout), nullptr, nullptr, 0, 0, 0);
     }
     catch(const std::runtime_error& e) {
 #ifdef WE_ARE_RECURSOR