grpc plugin: Use plugin_thread_create instead of pthread_create.
[collectd.git] / src / grpc.cc
index 2f79f42..a82c1ec 100644 (file)
@@ -88,12 +88,10 @@ static grpc::Status unmarshal_value_list(const collectd::types::ValueList &msg,
        sstrncpy(vl->type, s.c_str(), sizeof(vl->type));
 
        s = msg.plugin_instance();
-       if (s.length())
-               sstrncpy(vl->plugin_instance, s.c_str(), sizeof(vl->plugin_instance));
+       sstrncpy(vl->plugin_instance, s.c_str(), sizeof(vl->plugin_instance));
 
        s = msg.type_instance();
-       if (s.length())
-               sstrncpy(vl->type_instance, s.c_str(), sizeof(vl->type_instance));
+       sstrncpy(vl->type_instance, s.c_str(), sizeof(vl->type_instance));
 
        value_t *values = NULL;
        size_t values_len = 0;
@@ -126,7 +124,7 @@ static grpc::Status unmarshal_value_list(const collectd::types::ValueList &msg,
                        break;
                default:
                        status = grpc::Status(grpc::StatusCode::INVALID_ARGUMENT,
-                                       grpc::string("unkown value type"));
+                                       grpc::string("unknown value type"));
                        break;
                }
 
@@ -301,7 +299,7 @@ public:
                        }
                }
 
-               builder.RegisterAsyncService(&service_);
+               builder.RegisterService(&service_);
                cq_ = builder.AddCompletionQueue();
                server_ = builder.BuildAndStart();
        } /* Start() */
@@ -440,7 +438,7 @@ extern "C" {
 
                server->Start();
                for (i = 0; i < workers_num; i++) {
-                       pthread_create(&workers[i], /* attr = */ NULL,
+                       plugin_thread_create(&workers[i], /* attr = */ NULL,
                                        worker_thread, server);
                }
                INFO("grpc: Started %zu workers", workers_num);