fix data races in proxy server
[govpp.git] / core / control_ping.go
index 904068a..b39fd3f 100644 (file)
@@ -1,12 +1,24 @@
 package core
 
-import "git.fd.io/govpp.git/api"
+import (
+       "git.fd.io/govpp.git/api"
+)
 
 var (
        msgControlPing      api.Message = new(ControlPing)
        msgControlPingReply api.Message = new(ControlPingReply)
 )
 
+// SetControlPing sets the control ping message used by core.
+func SetControlPing(m api.Message) {
+       msgControlPing = m
+}
+
+// SetControlPingReply sets the control ping reply message used by core.
+func SetControlPingReply(m api.Message) {
+       msgControlPingReply = m
+}
+
 type ControlPing struct{}
 
 func (*ControlPing) GetMessageName() string {
@@ -34,3 +46,8 @@ func (*ControlPingReply) GetCrcString() string {
 func (*ControlPingReply) GetMessageType() api.MessageType {
        return api.ReplyMessage
 }
+
+func init() {
+       api.RegisterMessage((*ControlPing)(nil), "ControlPing")
+       api.RegisterMessage((*ControlPingReply)(nil), "ControlPingReply")
+}