You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/04/15 14:18:25 UTC

[GitHub] [nifi-minifi-cpp] bakaid commented on a change in pull request #687: MINIFICPP-1092 - Make CoAP compile and work on Windows

bakaid commented on a change in pull request #687: MINIFICPP-1092 - Make CoAP compile and work on Windows
URL: https://github.com/apache/nifi-minifi-cpp/pull/687#discussion_r408878101
 
 

 ##########
 File path: extensions/coap/COAPLoader.cpp
 ##########
 @@ -16,9 +16,36 @@
  * limitations under the License.
  */
 #include "core/FlowConfiguration.h"
+#include "core/logging/LoggerConfiguration.h"
 #include "COAPLoader.h"
 
+#ifdef WIN32
+#include <winsock2.h>
+#endif
+
 bool COAPObjectFactory::added = core::FlowConfiguration::add_static_func("createCOAPFactory");
+
+bool COAPObjectFactoryInitializer::initialize() {
+#ifdef WIN32
+  static WSADATA s_wsaData;
+  int iWinSockInitResult = WSAStartup(MAKEWORD(2, 2), &s_wsaData);
+  if (iWinSockInitResult != 0) {
+    logging::LoggerFactory<COAPObjectFactoryInitializer>::getLogger()->log_error("WSAStartup failed with error %d", iWinSockInitResult);
+    return false;
+  } else {
 
 Review comment:
   I think this is better readable this way.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services