mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
write full message to new array for async buffer
This commit is contained in:
+4
-2
@@ -44,12 +44,14 @@ func (o *TCPOutput) worker() {
|
||||
|
||||
for {
|
||||
conn.Write(<-o.buf)
|
||||
conn.Write([]byte("¶"))
|
||||
}
|
||||
}
|
||||
|
||||
func (o *TCPOutput) Write(data []byte) (n int, err error) {
|
||||
o.buf <- data
|
||||
new_buf := make([]byte, len(data) + 2)
|
||||
append(data, []byte("¶"))
|
||||
copy(new_buf, data)
|
||||
o.buf <- new_buf
|
||||
|
||||
return len(data), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user