simplerpc 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b7738bfae026e0fe2ddedbbd75dcc5013d834c1
4
- data.tar.gz: 493f8b4edf16ccd8e4ff094f6a32686837f8e7d0
3
+ metadata.gz: 35e03bbef72aa8b10a3ce67964e8ad2ae5a0a59d
4
+ data.tar.gz: b961f842f95b6b1e9b784bbb287c9a493b9ccb0c
5
5
  SHA512:
6
- metadata.gz: 7681f57a2e91e9dda12e9ceab903b4215a06e39a76bd8dbe3964570cf35a20039aa6333212b5fc532b97997c209c8218d843e56ef59c15b9b7024e8986ab5184
7
- data.tar.gz: d588acf4a236dd980f04b612523414c24d3a319ba1d4c7b93b547420538cba8001b2048536ee698bcd41c66dfc8ae28279b310ce0eebd977d051a83421a864a3
6
+ metadata.gz: c681277ce02e0857e4feb5e7ac937bb13fa28d6f7451914eecfcf46968631c35d2c491210aa89a4cb97bc0fefe3f15ed40ad0e8a492cd57f28a635505c329ed7
7
+ data.tar.gz: de1c8efba094eea904384d94478f8d891387631cf8bd93684174ef389fa7e7f6c2155fab8bb4c4f5a72ad67c198606ce76a311d494844a6de411da607e23b96c
@@ -99,7 +99,8 @@ module SimpleRPC
99
99
  private
100
100
  # Connect to the server
101
101
  def _connect
102
- @s = TCPSocket.open( @hostname, @port)
102
+ @s = TCPSocket.open( @hostname, @port )
103
+ raise "Failed to connect" if not @s
103
104
  end
104
105
 
105
106
  # Receive data from the server
@@ -11,15 +11,15 @@ module SimpleRPC
11
11
 
12
12
  # Create a new server for a given proxy object
13
13
  #
14
- # proxy:: The object to proxy the API for---any ruby object
14
+ # obj:: The object to proxy the API for---any ruby object
15
15
  # port:: The port to listen on
16
16
  # hostname:: The ip of the interface to listen on, or nil for all
17
17
  # serialiser:: The serialiser to use
18
18
  # threaded:: Should the server support multiple clients at once?
19
19
  # timeout:: Socket timeout
20
- def initialize(proxy, port, hostname=nil, serialiser=Serialiser.new, threaded=false, timeout = nil)
21
- @proxy = proxy
22
- @port = port
20
+ def initialize(obj, port, hostname=nil, serialiser=Serialiser.new, threaded=false, timeout=nil)
21
+ @obj = obj
22
+ @port = port
23
23
  @hostname = hostname
24
24
 
25
25
  # What format to use.
@@ -60,11 +60,11 @@ module SimpleRPC
60
60
  thread = Thread.new(id, @m, @s.accept){|id, m, c|
61
61
  handle_client(c)
62
62
 
63
- puts "#{id} closing 1"
63
+ # puts "#{id} closing 1"
64
64
  m.synchronize{
65
65
  @clients.delete(id)
66
66
  }
67
- puts "#{id} closing 2"
67
+ # puts "#{id} closing 2"
68
68
  }
69
69
 
70
70
  # Add to the client list
@@ -109,14 +109,14 @@ module SimpleRPC
109
109
  m, arity = recv(c)
110
110
 
111
111
  # Check the call is valid for the proxy object
112
- valid_call = (@proxy.respond_to?(m) and @proxy.method(m).arity == arity)
112
+ valid_call = (@obj.respond_to?(m) and @obj.method(m).arity == arity)
113
113
 
114
114
  send(c, valid_call)
115
115
 
116
116
  # Make the call if valid and send the result back
117
117
  if valid_call then
118
118
  args = recv(c)
119
- send(c, @proxy.send(m, *args) )
119
+ send(c, @obj.send(m, *args) )
120
120
  end
121
121
 
122
122
  c.close
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplerpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Wattam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-23 00:00:00.000000000 Z
11
+ date: 2013-05-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A very simple and fast RPC library
14
14
  email: stephenwattam@gmail.com
@@ -17,9 +17,9 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/simplerpc/client.rb
20
- - lib/simplerpc/server.rb
21
20
  - lib/simplerpc/socket_protocol.rb
22
21
  - lib/simplerpc/serialiser.rb
22
+ - lib/simplerpc/server.rb
23
23
  - LICENSE
24
24
  homepage: http://stephenwattam.com/projects/simplerpc
25
25
  licenses: