mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-23 12:54:24 +00:00
fix slave output over buffersize
This commit is contained in:
parent
48c794023a
commit
5b8ba12cb3
@ -72,7 +72,12 @@ func (wt *WebTTY) Run(ctx context.Context) error {
|
||||
errs <- func() error {
|
||||
buffer := make([]byte, wt.bufferSize)
|
||||
for {
|
||||
n, err := wt.slave.Read(buffer)
|
||||
//base64 length
|
||||
effectiveBufferSize := wt.bufferSize - 1
|
||||
//max raw data length
|
||||
maxChunkSize := int(effectiveBufferSize/4) * 3
|
||||
|
||||
n, err := wt.slave.Read(buffer[:maxChunkSize])
|
||||
if err != nil {
|
||||
return ErrSlaveClosed
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user