rapns 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,6 +88,8 @@ module Rapns
88
88
 
89
89
  def connect_socket
90
90
  tcp_socket = TCPSocket.new(Rapns::Daemon.configuration.host, Rapns::Daemon.configuration.port)
91
+ tcp_socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
92
+ tcp_socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
91
93
  ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, @ssl_context)
92
94
  ssl_socket.sync = true
93
95
  ssl_socket.connect
data/lib/rapns/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rapns
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -36,7 +36,7 @@ describe Rapns::Daemon::Connection, "when connecting the socket" do
36
36
  @connection.stub(:setup_at_exit_hook)
37
37
  @ssl_context = mock("SSLContext")
38
38
  @connection.stub(:setup_ssl_context).and_return(@ssl_context)
39
- @tcp_socket = mock("TCPSocket", :close => nil)
39
+ @tcp_socket = mock("TCPSocket", :close => nil, :setsockopt => nil)
40
40
  TCPSocket.stub(:new).and_return(@tcp_socket)
41
41
  Rapns::Daemon::Configuration.stub(:host).and_return("localhost")
42
42
  Rapns::Daemon::Configuration.stub(:port).and_return(123)
@@ -67,6 +67,16 @@ describe Rapns::Daemon::Connection, "when connecting the socket" do
67
67
  @ssl_socket.should_receive(:connect)
68
68
  @connection.connect
69
69
  end
70
+
71
+ it "should set the socket option TCP_NODELAY" do
72
+ @tcp_socket.should_receive(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
73
+ @connection.connect
74
+ end
75
+
76
+ it "should set the socket option SO_KEEPALIVE" do
77
+ @tcp_socket.should_receive(:setsockopt).with(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
78
+ @connection.connect
79
+ end
70
80
  end
71
81
 
72
82
  describe Rapns::Daemon::Connection, "when shuting down the connection" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-31 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Easy to use library for Apple's Push Notification Service with Rails
15
15
  3