|  | @@ -15,9 +15,10 @@ type Writer struct {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func NewWriter(id uint16, dest net.Destination, writer buf.Writer) *Writer {
 |  |  func NewWriter(id uint16, dest net.Destination, writer buf.Writer) *Writer {
 | 
											
												
													
														|  |  	return &Writer{
 |  |  	return &Writer{
 | 
											
												
													
														|  | -		id:     id,
 |  | 
 | 
											
												
													
														|  | -		dest:   dest,
 |  | 
 | 
											
												
													
														|  | -		writer: writer,
 |  | 
 | 
											
												
													
														|  | 
 |  | +		id:       id,
 | 
											
												
													
														|  | 
 |  | +		dest:     dest,
 | 
											
												
													
														|  | 
 |  | +		writer:   writer,
 | 
											
												
													
														|  | 
 |  | +		followup: false,
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -29,7 +30,7 @@ func NewResponseWriter(id uint16, writer buf.Writer) *Writer {
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -func (w *Writer) Write(mb buf.MultiBuffer) error {
 |  | 
 | 
											
												
													
														|  | 
 |  | +func (w *Writer) writeInternal(mb buf.MultiBuffer) error {
 | 
											
												
													
														|  |  	meta := FrameMetadata{
 |  |  	meta := FrameMetadata{
 | 
											
												
													
														|  |  		SessionID: w.id,
 |  |  		SessionID: w.id,
 | 
											
												
													
														|  |  		Target:    w.dest,
 |  |  		Target:    w.dest,
 | 
											
										
											
												
													
														|  | @@ -58,6 +59,17 @@ func (w *Writer) Write(mb buf.MultiBuffer) error {
 | 
											
												
													
														|  |  	return w.writer.Write(mb2)
 |  |  	return w.writer.Write(mb2)
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +func (w *Writer) Write(mb buf.MultiBuffer) error {
 | 
											
												
													
														|  | 
 |  | +	const chunkSize = 8 * 1024
 | 
											
												
													
														|  | 
 |  | +	for !mb.IsEmpty() {
 | 
											
												
													
														|  | 
 |  | +		slice := mb.SliceBySize(chunkSize)
 | 
											
												
													
														|  | 
 |  | +		if err := w.writeInternal(slice); err != nil {
 | 
											
												
													
														|  | 
 |  | +			return err
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +	return nil
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  func (w *Writer) Close() {
 |  |  func (w *Writer) Close() {
 | 
											
												
													
														|  |  	meta := FrameMetadata{
 |  |  	meta := FrameMetadata{
 | 
											
												
													
														|  |  		SessionID:     w.id,
 |  |  		SessionID:     w.id,
 |