DHT Nill pointer fix
This commit is contained in:
parent
1472fb7cfd
commit
d04e075e51
@ -1118,10 +1118,14 @@ func (g *Gateway) handleTorrentUpload(w http.ResponseWriter, r *http.Request, fi
|
||||
}
|
||||
|
||||
// Queue video for transcoding if applicable
|
||||
log.Printf("DEBUG: Transcoding check for %s - transcodingManager: %t, streamingInfo: %t, autoTranscode: %t",
|
||||
fileName, g.transcodingManager != nil, streamingInfo != nil, g.config.Transcoding.AutoTranscode)
|
||||
|
||||
if g.transcodingManager != nil && streamingInfo != nil && g.config.Transcoding.AutoTranscode {
|
||||
// For torrent files, we need to reconstruct the original file for transcoding
|
||||
go func() {
|
||||
// Run in background to not block upload response
|
||||
log.Printf("DEBUG: Starting transcoding reconstruction for %s", fileName)
|
||||
originalPath, err := g.ReconstructTorrentFile(metadata.Hash, fileName)
|
||||
if err != nil {
|
||||
log.Printf("Warning: Failed to reconstruct file %s for transcoding: %v", fileName, err)
|
||||
@ -1131,6 +1135,8 @@ func (g *Gateway) handleTorrentUpload(w http.ResponseWriter, r *http.Request, fi
|
||||
log.Printf("Queueing large video file %s for transcoding", fileName)
|
||||
g.transcodingManager.QueueVideoForTranscoding(metadata.Hash, fileName, originalPath, metadata.Size)
|
||||
}()
|
||||
} else {
|
||||
log.Printf("DEBUG: Transcoding skipped for %s - missing conditions", fileName)
|
||||
}
|
||||
|
||||
// Send success response for torrent
|
||||
|
@ -2233,6 +2233,12 @@ func (d *DHT) queryNodesParallel(candidates []*Node, targetID NodeID, queryType
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
// Validate node before proceeding
|
||||
if node == nil || node.Addr == nil {
|
||||
log.Printf("DHT query: skipping nil node or address")
|
||||
return
|
||||
}
|
||||
|
||||
key := fmt.Sprintf("%s:%d", node.Addr.IP, node.Addr.Port)
|
||||
queriedMutex.Lock()
|
||||
queried[key] = true
|
||||
|
BIN
torrent-gateway
BIN
torrent-gateway
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user