Skip to content
Permalink
Browse files
JENKINS-7836 tentative fix for the copy from slave to master issues. …
…The problem looks similar to JENKINS-7745, so we might as well synchronized the ProxyInputStream.
  • Loading branch information
lacostej committed Feb 3, 2011
1 parent 3ddb68f commit 31b8361d3152fb7970e1c11c906a763fa1aa5c25
Showing with 6 additions and 2 deletions.
  1. +6 −2 remoting/src/main/java/hudson/remoting/ProxyInputStream.java
@@ -55,7 +55,7 @@ public ProxyInputStream(Channel channel, int oid) throws IOException {
@Override
public int read() throws IOException {
try {
Buffer buf = new Chunk(oid, 1).call(channel);
Buffer buf = _read(1);
if(buf.len==1)
// byte->int expansion needs to be done carefully becaue byte in Java is signed
// whose idea was it to make byte signed, anyway!?
@@ -70,10 +70,14 @@ public int read() throws IOException {
}
}

private synchronized Buffer _read(int len) throws IOException, InterruptedException {
return new Chunk(oid, len).call(channel);
}

@Override
public int read(byte b[], int off, int len) throws IOException {
try {
Buffer buf = new Chunk(oid,len).call(channel);
Buffer buf = _read(len);
if(buf.len==-1) return -1;
System.arraycopy(buf.buf,0,b,off,buf.len);
return buf.len;

0 comments on commit 31b8361

Please sign in to comment.