Ready for new release with new engine, will start bugfixes
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
UploadRateLimit = "Unlimited" #Options are "Low", "Medium", "High", "Unlimited" #Unlimited is default
|
||||
DownloadRateLimit = "Unlimited"
|
||||
#Maximum number of allowed active torrents, the rest will be queued
|
||||
MaxActiveTorrents = 2
|
||||
MaxActiveTorrents = 5
|
||||
|
||||
[goTorrentWebUI]
|
||||
#Basic goTorrentWebUI authentication (not terribly secure, implemented in JS, password is hashed to SHA256, not salted, basically don't depend on this if you require very good security)
|
||||
|
@@ -32,6 +32,10 @@ func CreateServerPushMessage(message ServerPushMessage, conn *websocket.Conn) {
|
||||
conn.WriteJSON(message)
|
||||
}
|
||||
|
||||
func QueueJSONMessage(conn *websocket.Conn){
|
||||
|
||||
}
|
||||
|
||||
//RefreshSingleRSSFeed refreshing a single RSS feed to send to the client (so no updating database) mainly by updating the torrent list to display any changes
|
||||
func RefreshSingleRSSFeed(db *storm.DB, RSSFeed Storage.SingleRSSFeed) Storage.SingleRSSFeed { //Todo.. duplicate as cron job... any way to merge these to reduce duplication?
|
||||
singleRSSFeed := Storage.SingleRSSFeed{URL: RSSFeed.URL, Name: RSSFeed.Name}
|
||||
@@ -376,6 +380,7 @@ func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Sto
|
||||
RunningTorrentArray = append(RunningTorrentArray, *fullClientDB)
|
||||
|
||||
}
|
||||
ValidateQueues(db, config, tclient) //Ensure we don't have too many in activeQueue
|
||||
return RunningTorrentArray
|
||||
}
|
||||
|
||||
|
@@ -319,6 +319,20 @@ func RemoveDuplicatesFromQueues(db *storm.DB) {
|
||||
Storage.UpdateQueues(db, torrentQueues)
|
||||
}
|
||||
|
||||
//ValidateQueues is a sanity check that runs every tick to make sure the queues are in order... tried to avoid this but seems to be required
|
||||
func ValidateQueues(db *storm.DB, config Settings.FullClientSettings, tclient *torrent.Client) {
|
||||
torrentQueues := Storage.FetchQueues(db)
|
||||
for len(torrentQueues.ActiveTorrents) > config.MaxActiveTorrents {
|
||||
removeTorrent := torrentQueues.ActiveTorrents[:1]
|
||||
for _, singleTorrent := range tclient.Torrents() {
|
||||
if singleTorrent.InfoHash().String() == removeTorrent[0] {
|
||||
singleTorrentFromStorage := Storage.FetchTorrentFromStorage(db, removeTorrent[0])
|
||||
RemoveTorrentFromActive(&singleTorrentFromStorage, singleTorrent, db)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CalculateTorrentStatus is used to determine what the STATUS column of the frontend will display ll2
|
||||
func CalculateTorrentStatus(t *torrent.Torrent, c *ClientDB, config Settings.FullClientSettings, tFromStorage *storage.TorrentLocal, bytesCompleted int64, totalSize int64, torrentQueues Storage.TorrentQueues, db *storm.DB) {
|
||||
if tFromStorage.TorrentStatus == "Stopped" {
|
||||
|
4
main.go
4
main.go
@@ -51,7 +51,7 @@ func serveHome(w http.ResponseWriter, r *http.Request) {
|
||||
func handleAuthentication(conn *websocket.Conn, db *storm.DB) {
|
||||
msg := Engine.Message{}
|
||||
err := conn.ReadJSON(&msg)
|
||||
conn.WriteJSON(msg) //TODO just for testing, remove
|
||||
//conn.WriteJSON(msg) //TODO just for testing, remove
|
||||
payloadData, ok := msg.Payload.(map[string]interface{})
|
||||
clientAuthToken, tokenOk := payloadData["ClientAuthString"].(string)
|
||||
fmt.Println("ClientAuthToken:", clientAuthToken, "TokenOkay", tokenOk, "PayloadData", payloadData, "PayloadData Okay?", ok)
|
||||
@@ -284,7 +284,7 @@ func main() {
|
||||
Logger.WithFields(logrus.Fields{"message": msg}).Debug("Client Requested TorrentList Update")
|
||||
|
||||
go func() { //running updates in separate thread so can still accept commands
|
||||
TorrentLocalArray = Storage.FetchAllStoredTorrents(db) //Required to re-read th database since we write to the DB and this will pull the changes from it
|
||||
TorrentLocalArray = Storage.FetchAllStoredTorrents(db) //Required to re-read the database since we write to the DB and this will pull the changes from it
|
||||
RunningTorrentArray = Engine.CreateRunningTorrentArray(tclient, TorrentLocalArray, PreviousTorrentArray, Config, db) //Updates the RunningTorrentArray with the current client data as well
|
||||
PreviousTorrentArray = RunningTorrentArray
|
||||
torrentlistArray := Engine.TorrentList{MessageType: "torrentList", ClientDBstruct: RunningTorrentArray, Totaltorrents: len(RunningTorrentArray)}
|
||||
|
Reference in New Issue
Block a user