Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-yamux
Commits
0e0bf2a9
Commit
0e0bf2a9
authored
May 20, 2021
by
Marten Seemann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set initial window size to spec value (256 kB), remove config option
parent
391ef8d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
21 deletions
+16
-21
const.go
const.go
+3
-2
mux.go
mux.go
+12
-17
session_test.go
session_test.go
+1
-1
stream.go
stream.go
+0
-1
No files found.
const.go
View file @
0e0bf2a9
...
...
@@ -113,8 +113,9 @@ const (
)
const
(
// initialStreamWindow is the initial stream window size
initialStreamWindow
uint32
=
64
*
1024
// initialStreamWindow is the initial stream window size.
// It's not an implementation choice, the value defined in the specification.
initialStreamWindow
uint32
=
256
*
1024
maxStreamWindow
uint32
=
16
*
1024
*
1024
)
...
...
mux.go
View file @
0e0bf2a9
...
...
@@ -31,10 +31,6 @@ type Config struct {
// an expectation that things will move along quickly.
ConnectionWriteTimeout
time
.
Duration
// InitialStreamWindowSize is used to control the initial
// window size that we allow for a stream.
InitialStreamWindowSize
uint32
// MaxStreamWindowSize is used to control the maximum
// window size that we allow for a stream.
MaxStreamWindowSize
uint32
...
...
@@ -60,17 +56,16 @@ type Config struct {
// DefaultConfig is used to return a default configuration
func
DefaultConfig
()
*
Config
{
return
&
Config
{
AcceptBacklog
:
256
,
PingBacklog
:
32
,
EnableKeepAlive
:
true
,
KeepAliveInterval
:
30
*
time
.
Second
,
ConnectionWriteTimeout
:
10
*
time
.
Second
,
InitialStreamWindowSize
:
initialStreamWindow
,
MaxStreamWindowSize
:
maxStreamWindow
,
LogOutput
:
os
.
Stderr
,
ReadBufSize
:
4096
,
MaxMessageSize
:
64
*
1024
,
WriteCoalesceDelay
:
100
*
time
.
Microsecond
,
AcceptBacklog
:
256
,
PingBacklog
:
32
,
EnableKeepAlive
:
true
,
KeepAliveInterval
:
30
*
time
.
Second
,
ConnectionWriteTimeout
:
10
*
time
.
Second
,
MaxStreamWindowSize
:
maxStreamWindow
,
LogOutput
:
os
.
Stderr
,
ReadBufSize
:
4096
,
MaxMessageSize
:
64
*
1024
,
WriteCoalesceDelay
:
100
*
time
.
Microsecond
,
}
}
...
...
@@ -82,8 +77,8 @@ func VerifyConfig(config *Config) error {
if
config
.
KeepAliveInterval
==
0
{
return
fmt
.
Errorf
(
"keep-alive interval must be positive"
)
}
if
config
.
MaxStreamWindowSize
<
config
.
I
nitialStreamWindow
Size
{
return
errors
.
New
(
"MaxStreamWindowSize must be larger than the
I
nitialStreamWindow
Size
"
)
if
config
.
MaxStreamWindowSize
<
i
nitialStreamWindow
{
return
errors
.
New
(
"MaxStreamWindowSize must be larger than the
i
nitialStreamWindow
(256 kB)
"
)
}
if
config
.
MaxMessageSize
<
1024
{
return
fmt
.
Errorf
(
"MaxMessageSize must be greater than a kilobyte"
)
...
...
session_test.go
View file @
0e0bf2a9
...
...
@@ -1194,7 +1194,7 @@ func TestSession_PartialReadWindowUpdate(t *testing.T) {
sendWindow
:=
atomic
.
LoadUint32
(
&
wr
.
sendWindow
)
if
sendWindow
!=
initialStreamWindow
{
t
.
Errorf
(
"sendWindow: exp=%d, got=%d"
,
client
.
config
.
I
nitialStreamWindow
Size
,
sendWindow
)
t
.
Errorf
(
"sendWindow: exp=%d, got=%d"
,
i
nitialStreamWindow
,
sendWindow
)
}
n
,
err
:=
wr
.
Write
(
make
([]
byte
,
flood
))
...
...
stream.go
View file @
0e0bf2a9
...
...
@@ -52,7 +52,6 @@ type Stream struct {
// newStream is used to construct a new stream within
// a given session for an ID
func
newStream
(
session
*
Session
,
id
uint32
,
state
streamState
)
*
Stream
{
initialStreamWindow
:=
session
.
config
.
InitialStreamWindowSize
s
:=
&
Stream
{
id
:
id
,
session
:
session
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment