Skip to content

Conversation

y3llowcake
Copy link
Contributor

No description provided.

@y3llowcake
Copy link
Contributor Author

Hoping this is relatively uncontroversial, in theory it should only improve on existing performance characteristics.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test for w.fw == nil in Write method.

defer func() {
flateWriterPool.Put(w.fw)
w.fw = nil
}()
err1 := w.fw.Flush()
if w.tw.p != [4]byte{0, 0, 0xff, 0xff} {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the defer and add the following after Flush()

 flatWritePool.Put(w.fw)
 w.fw = nil

@@ -73,6 +85,13 @@ func (w *flateWrapper) Write(p []byte) (int, error) {
}

func (w *flateWrapper) Close() error {
if w.fw == nil {
return errors.New("already closed")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return errWriteClosed.

@y3llowcake
Copy link
Contributor Author

Done

@ghost
Copy link

ghost commented Dec 16, 2016

Does not compile.

@y3llowcake
Copy link
Contributor Author

Sorry, I'm terrible with computers. This should be fixed now.

@ghost ghost merged commit 3ab3a8b into gorilla:master Dec 17, 2016
@ghost ghost locked and limited conversation to collaborators Feb 14, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant