Skip to content

Commit

Permalink
Also set Http.cnxTimeout to 0 if we pass -notimeout (closes #235)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadako committed Mar 10, 2016
1 parent 1aa6cf2 commit 7b21995
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/haxelib/client/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ class Main {
Sys.exit(1);
}

inline function createHttpRequest(url:String):Http {
var req = new Http(url);
if (haxe.remoting.HttpConnection.TIMEOUT == 0)
req.cnxTimeout = 0;
return req;
}

// ---- COMMANDS --------------------

function search() {
Expand Down Expand Up @@ -547,7 +554,7 @@ class Main {
var id = site.getSubmitId();

// directly send the file data over Http
var h = new Http("http://"+SERVER.host+":"+SERVER.port+"/"+SERVER.url);
var h = createHttpRequest("http://"+SERVER.host+":"+SERVER.port+"/"+SERVER.url);
h.onError = function(e) { throw e; };
h.onData = print;
h.fileTransfer("file",id,new ProgressIn(new haxe.io.BytesInput(data),data.length),data.length);
Expand Down Expand Up @@ -723,7 +730,7 @@ class Main {
catch (e:Dynamic) throw 'Failed to write to $filepath: $e';

var progress = new ProgressOut(out);
var h = new Http(siteUrl+Data.REPOSITORY+"/"+filename);
var h = createHttpRequest(siteUrl+Data.REPOSITORY+"/"+filename);
h.onError = function(e) {
progress.close();
FileSystem.deleteFile(filepath);
Expand Down

1 comment on commit 7b21995

@hughsando
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.