diff --git a/plugin/gb28181/api.go b/plugin/gb28181/api.go index b5d06a3..84b7621 100644 --- a/plugin/gb28181/api.go +++ b/plugin/gb28181/api.go @@ -2811,6 +2811,7 @@ func (gb *GB28181Plugin) RemoveDevice(ctx context.Context, req *pb.RemoveDeviceR if device, ok := gb.devices.Get(dbDevice.DeviceId); ok { // 停止设备相关任务 device.Stop(fmt.Errorf("device removed")) + device.WaitStopped() // device.Stop() 会调用 Dispose(),其中已包含从 gb.devices 中移除设备的逻辑 } diff --git a/plugin/gb28181/pb/gb28181.pb.go b/plugin/gb28181/pb/gb28181.pb.go index d9153ab..907d175 100644 --- a/plugin/gb28181/pb/gb28181.pb.go +++ b/plugin/gb28181/pb/gb28181.pb.go @@ -6646,7 +6646,7 @@ const file_gb28181_proto_rawDesc = "" + "\x0fAddGroupChannel\x12\".gb28181pro.AddGroupChannelRequest\x1a\x18.gb28181pro.BaseResponse\";\x82\xd3\xe4\x93\x025:\bchannels\")/gb28181/api/groups/channel/add/{groupId}\x12\x8e\x01\n" + "\x12DeleteGroupChannel\x12%.gb28181pro.DeleteGroupChannelRequest\x1a\x18.gb28181pro.BaseResponse\"7\x82\xd3\xe4\x93\x021:\x01*\",/gb28181/api/groups/channel/delete/{groupId}\x12\x8a\x01\n" + "\x10GetGroupChannels\x12#.gb28181pro.GetGroupChannelsRequest\x1a!.gb28181pro.GroupChannelsResponse\".\x82\xd3\xe4\x93\x02(\x12&/gb28181/api/groups/{groupId}/channels\x12r\n" + - "\fRemoveDevice\x12\x1f.gb28181pro.RemoveDeviceRequest\x1a\x18.gb28181pro.BaseResponse\"'\x82\xd3\xe4\x93\x02!\x12\x1f/gb28181/api/device/remove/{id}B\x1fZ\x1dm7s.live/v5/plugin/gb28181/pbb\x06proto3" + "\fRemoveDevice\x12\x1f.gb28181pro.RemoveDeviceRequest\x1a\x18.gb28181pro.BaseResponse\"'\x82\xd3\xe4\x93\x02!\"\x1f/gb28181/api/device/remove/{id}B\x1fZ\x1dm7s.live/v5/plugin/gb28181/pbb\x06proto3" var ( file_gb28181_proto_rawDescOnce sync.Once diff --git a/plugin/gb28181/pb/gb28181.pb.gw.go b/plugin/gb28181/pb/gb28181.pb.gw.go index a89d67c..a05380e 100644 --- a/plugin/gb28181/pb/gb28181.pb.gw.go +++ b/plugin/gb28181/pb/gb28181.pb.gw.go @@ -4421,7 +4421,7 @@ func RegisterApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Api_GetGroupChannels_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_Api_RemoveDevice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_Api_RemoveDevice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -5569,7 +5569,7 @@ func RegisterApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Api_GetGroupChannels_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_Api_RemoveDevice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_Api_RemoveDevice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) diff --git a/plugin/gb28181/pb/gb28181.proto b/plugin/gb28181/pb/gb28181.proto index 44c406d..d379744 100644 --- a/plugin/gb28181/pb/gb28181.proto +++ b/plugin/gb28181/pb/gb28181.proto @@ -477,7 +477,7 @@ service api { // 删除设备 rpc RemoveDevice (RemoveDeviceRequest) returns (BaseResponse) { option (google.api.http) = { - get: "/gb28181/api/device/remove/{id}" + post: "/gb28181/api/device/remove/{id}" }; } }