Merge b2c5107d21 into 9d7a29fe26
				
					
				
			This commit is contained in:
		
						commit
						df43075092
					
				| @ -137,10 +137,14 @@ func (a *agent) read(length int) (data []byte, err error) { | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| var m = sync.Mutex{} | ||||
| 
 | ||||
| // Internal write the encoded job.
 | ||||
| func (a *agent) write(outpack *outPack) (err error) { | ||||
| 	var n int | ||||
| 	buf := outpack.Encode() | ||||
| 	m.Lock() | ||||
| 	defer m.Unlock() | ||||
| 	for i := 0; i < len(buf); i += n { | ||||
| 		n, err = a.rw.Write(buf[i:]) | ||||
| 		if err != nil { | ||||
|  | ||||
| @ -279,6 +279,7 @@ func (worker *Worker) exec(inpack *inPack) (err error) { | ||||
| 		} | ||||
| 		outpack.handle = inpack.handle | ||||
| 		outpack.data = r.data | ||||
| 		 //exec() maybe called concurrently, take care of race condition
 | ||||
| 		inpack.a.write(outpack) | ||||
| 	} | ||||
| 	return | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user