🛠️ fix:入站删除时报错
This commit is contained in:
@@ -1536,13 +1536,22 @@ func (h *ManageHandler) manageInbound(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.removeInbound(ctx, clients.Handler, req.Tag); err != nil {
|
// Try to remove from runtime (ignore error if not running)
|
||||||
writeError(w, http.StatusInternalServerError, fmt.Sprintf("Failed to remove inbound: %v", err))
|
runtimeErr := h.removeInbound(ctx, clients.Handler, req.Tag)
|
||||||
return
|
if runtimeErr != nil {
|
||||||
|
log.Printf("[Manage] Warning: Failed to remove inbound from runtime: %v", runtimeErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.removeInboundFromConfig(req.Tag); err != nil {
|
// Remove from config file (this is the primary operation)
|
||||||
log.Printf("[Manage] Warning: Failed to remove inbound from config: %v", err)
|
configErr := h.removeInboundFromConfig(req.Tag)
|
||||||
|
if configErr != nil {
|
||||||
|
log.Printf("[Manage] Warning: Failed to remove inbound from config: %v", configErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success if at least one operation succeeded
|
||||||
|
if runtimeErr != nil && configErr != nil {
|
||||||
|
writeError(w, http.StatusInternalServerError, fmt.Sprintf("Failed to remove inbound: runtime=%v, config=%v", runtimeErr, configErr))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
writeJSON(w, http.StatusOK, map[string]interface{}{
|
writeJSON(w, http.StatusOK, map[string]interface{}{
|
||||||
|
|||||||
Reference in New Issue
Block a user