Commit be786108 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/rpc: make buffer real big for writes [GH-755]

parent b5f1fd14
...@@ -402,10 +402,13 @@ func (m *MuxConn) loop() { ...@@ -402,10 +402,13 @@ func (m *MuxConn) loop() {
case streamStateFinWait2: case streamStateFinWait2:
fallthrough fallthrough
case streamStateEstablished: case streamStateEstablished:
select { if len(data) > 0 {
case stream.writeCh <- data: select {
default: case stream.writeCh <- data:
panic(fmt.Sprintf("Failed to write data, buffer full for stream %d", id)) default:
panic(fmt.Sprintf(
"Failed to write data, buffer full for stream %d", id))
}
} }
default: default:
log.Printf("[ERR] Data received for stream in state: %d", stream.state) log.Printf("[ERR] Data received for stream in state: %d", stream.state)
...@@ -469,7 +472,7 @@ const ( ...@@ -469,7 +472,7 @@ const (
func newStream(from muxPacketFrom, id uint32, m *MuxConn) *Stream { func newStream(from muxPacketFrom, id uint32, m *MuxConn) *Stream {
// Create the stream object and channel where data will be sent to // Create the stream object and channel where data will be sent to
dataR, dataW := io.Pipe() dataR, dataW := io.Pipe()
writeCh := make(chan []byte, 256) writeCh := make(chan []byte, 4096)
// Set the data channel so we can write to it. // Set the data channel so we can write to it.
stream := &Stream{ stream := &Stream{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment