Skip to content
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

Dont throw away ssl connection #54

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

kbrock
Copy link
Contributor

@kbrock kbrock commented Mar 28, 2013

a) no need to throw away ssl connection object, when a simple disconnect / close would do.
b) aliases disconnect to close, since that is the name of the methods on the underlying ruby classes.
c) test the few remaining methods that didn't have test coverage

@@ -6,7 +6,7 @@
let(:connection_options) { { certificate: '/path/to/cert.pem',
gateway: 'push.example.com',
port: 443 } }
let(:ssl) { stub_everything('SSLConnection') }
let(:ssl) { stub('SSLConnection', connect: nil, new: nil, write: nil, read: nil, disconnect: nil) }
Copy link
Member

Choose a reason for hiding this comment

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

Nice. I prefer to tighten down the API when possible.

@stevenharman
Copy link
Member

b) aliases disconnect to close, since that is the name of the methods on the underlying ruby classes.

I find the mix of close and disconnect confusing. Should we just change everything to use #close for some consistency?

@kbrock
Copy link
Contributor Author

kbrock commented Mar 28, 2013

I wanted to do that, but didn't want to break backward compatibility.

Does close sound good to you?

@kbrock
Copy link
Contributor Author

kbrock commented Mar 28, 2013

Thanks @stevenharman
I can remove close => disconnect rename if that distracts from the this pull request

@stevenharman
Copy link
Member

@kbrock Can you mention the breaking changes in the Changelog? And feel free to add your own contributions to the list as well! :)

@kbrock
Copy link
Contributor Author

kbrock commented Mar 29, 2013

@stevenharman

a) made those changes
b) moved ssl configuration from connection into ssl_connection.
c) rebased onto master
d) added delegators to support feedback specs (which otherwise seemed unnecessary)

@@ -75,6 +44,11 @@
subject.read(42, 'IO')
ssl.should have_received(:read).with(42, 'IO')
end

it "#close" do
Copy link
Member

Choose a reason for hiding this comment

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

Something more descriptive like it "delegates close to the ssl connection" would be nice here.

@kbrock
Copy link
Contributor Author

kbrock commented Mar 30, 2013

@vanstee

I added read_with_timeout in a way that I think is useful for both single and multi-threaded implementations

timeout of null blocks
timeout of 0 never blocks
timeout of 5 blocks for 5 seconds (useful for multi-threaded so it can check a @stop variable and close the thread gracefully)

Not going through with_connection is important, so I'd like to get that knowledge into the core objects. As I've stated before, using the read in a with_connection caused our servers to crash every hour for the past week.

If it slows down this pull request, just say the word and I can tear it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants