// Auth token was invalidated; retry at max 3 times
authtoken=null;// So that ensureToken() will request a new token on the next try
if(retried<2){
returnmakeUtorrentRequest(addToUrl,retried++);
}
thrownewDaemonException(ExceptionType.AuthenticationFailure,"Response was '"+result.replace("\n","")+"' instead of a proper JSON object (and we used auth token '"+authtoken+"')");
thrownewDaemonException(ExceptionType.AuthenticationFailure,"Response was '"+result.replace("\n","")+"' instead of a proper JSON object (and we used auth token '"+authtoken+"')");
}
}
JSONObjectjson=newJSONObject(result);
JSONObjectjson=newJSONObject(result);
@ -329,7 +337,7 @@ public class UtorrentAdapter implements IDaemonAdapter {
if(authtoken==null){
if(authtoken==null){
// Make a request to /gui/token.html
// Make a request to /gui/token.html
// See http://trac.utorrent.com/trac/wiki/TokenSystem
// See https://github.com/bittorrent/webui/wiki/TokenSystem