mirror of
https://github.com/yudai/gotty.git
synced 2026-01-17 15:05:30 +01:00
Split input into buffer sized chunks
Input chunks from the client exceeding the buffer size would get truncated. Now we communicate the size of the buffer to the webtty and it will split the input into buffer sized chunks. Fixes #1.
This commit is contained in:
parent
77c436b99b
commit
0d6766f621
6 changed files with 27 additions and 3 deletions
|
|
@ -28,4 +28,6 @@ const (
|
|||
SetPreferences = '4'
|
||||
// Make terminal to reconnect
|
||||
SetReconnect = '5'
|
||||
// Set the input buffer size
|
||||
SetBufferSize = '6'
|
||||
)
|
||||
|
|
|
|||
|
|
@ -115,6 +115,12 @@ func (wt *WebTTY) sendInitializeMessage() error {
|
|||
return errors.Wrapf(err, "failed to send window title")
|
||||
}
|
||||
|
||||
bufSizeMsg, _ := json.Marshal(wt.bufferSize)
|
||||
err = wt.masterWrite(append([]byte{SetBufferSize}, bufSizeMsg...))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to send buffer size")
|
||||
}
|
||||
|
||||
if wt.reconnect > 0 {
|
||||
reconnect, _ := json.Marshal(wt.reconnect)
|
||||
err := wt.masterWrite(append([]byte{SetReconnect}, reconnect...))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue