-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a MemoryManager #69
Conversation
if !ok { | ||
return | ||
} | ||
s.memoryManager.ReleaseMemory(int(str.recvWindow)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use a transactional scope here, but it's easy enough to just release the memory manually.
return ErrDuplicateStream | ||
} | ||
|
||
if s.numIncomingStreams >= s.config.MaxIncomingStreams { | ||
// too many active streams at the same time | ||
s.logger.Printf("[WARN] yamux: MaxIncomingStreams exceeded, forcing stream reset") | ||
delete(s.streams, id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that at this point we haven't inserted the stream into the map yet, so this delete
was not needed in the first place.
stream.go
Outdated
if err == nil && status == MemoryStatusOK { | ||
s.recvWindow = recvWindow | ||
_, delta = s.recvBuf.GrowTo(s.recvWindow, true) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait here we have to release memory back if it is Caution or Critical but the error is nil, as it was actually reserved!
4a4f886
to
35fc6dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually wait, as we discussed this is the wrong scope -- it is statically configured, so it is the peer scope by necessity.
No description provided.