nobject 1.1.9 → 1.1.11
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 +4 -4
- data/lib/nobject/local.rb +12 -5
- data/lib/nobject/remote.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 258d8745928db2aa362e8f2153c7472bbd4edeb8332c06fd6585dd98b1e4a514
|
4
|
+
data.tar.gz: 951050aacf7ea2bca127084e50eea66fe93bb06b1404807f7d4c58b4bc540171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60a285e9dad1e9c3d30b416c001ced58566b122c84130f0faaaa06fc4edb14249cfaddf9c168a9bb7ddcaebe2052f59e66f2565dacde7d81e3d372b60723e469
|
7
|
+
data.tar.gz: a1313813596afcaf3feb89fd46fca56d1fb1d67171322987353568cfea825bcb155642bcf3e1b031510e1be3c7a896fbeadeb8ab0b1158b6a76db076bf34d2f4
|
data/lib/nobject/local.rb
CHANGED
@@ -17,7 +17,7 @@ module Nobject
|
|
17
17
|
@socket = TCPSocket.new(host, port)
|
18
18
|
obj_bytes = Marshal.dump(obj)
|
19
19
|
|
20
|
-
File.open('/tmp/nobject.log', 'a') {|f| f.puts "L
|
20
|
+
File.open('/tmp/nobject.log', 'a') {|f| f.puts "L:##{@msg_counter += 1} sz#{obj_bytes.length}"; f.flush }
|
21
21
|
@socket.send([obj_bytes.length].pack('Q>'), 0)
|
22
22
|
@socket.send(obj_bytes, 0)
|
23
23
|
end
|
@@ -28,7 +28,7 @@ module Nobject
|
|
28
28
|
|
29
29
|
begin
|
30
30
|
@socket.send([msg_bytes.length].pack('Q>'), 0)
|
31
|
-
File.open('/tmp/nobject.log', 'a') {|f| f.puts " LMS
|
31
|
+
File.open('/tmp/nobject.log', 'a') {|f| f.puts " LMS:##{@msg_counter += 1} sz#{msg_bytes.length}"; f.flush }
|
32
32
|
@socket.send(msg_bytes, 0)
|
33
33
|
rescue Exception
|
34
34
|
raise Local::MethodRequestFailure.new("did not receive response from call to `#{method}' over the network")
|
@@ -36,10 +36,17 @@ module Nobject
|
|
36
36
|
|
37
37
|
return_data = begin
|
38
38
|
msg_size = @socket.recv(8).unpack('Q>').first
|
39
|
-
File.open('/tmp/nobject.log', 'a') {|f| f.puts " LMGotit
|
39
|
+
File.open('/tmp/nobject.log', 'a') {|f| f.puts " LMGotit :##{@msg_counter += 1} sz#{msg_size}"; f.flush }
|
40
40
|
Marshal.load(@socket.recv(msg_size))
|
41
|
-
rescue Exception
|
42
|
-
|
41
|
+
rescue Exception => e
|
42
|
+
error_msg = <<~MSG
|
43
|
+
did not receive response from call to `#{method}' over the network
|
44
|
+
would have been msg_id #{msg_counter} OR #{msg_counter + 1}
|
45
|
+
caused by #{e.class.name}
|
46
|
+
exception backtrace:
|
47
|
+
#{e.backtrace.join("\n ")}
|
48
|
+
MSG
|
49
|
+
raise Local::MethodResponseFailure.new(error_msg)
|
43
50
|
end
|
44
51
|
|
45
52
|
case return_data.first
|
data/lib/nobject/remote.rb
CHANGED
@@ -7,7 +7,7 @@ module Nobject
|
|
7
7
|
@msg_counter = 0
|
8
8
|
@socket = socket
|
9
9
|
obj_size = @socket.recv(8).unpack('Q>').first
|
10
|
-
File.open('/tmp/nobject.log', 'a') {|f| f.puts "R
|
10
|
+
File.open('/tmp/nobject.log', 'a') {|f| f.puts "R:##{@msg_counter += 1} sz#{obj_size}"; f.flush }
|
11
11
|
@obj = Marshal.load(@socket.recv(obj_size))
|
12
12
|
end
|
13
13
|
|
@@ -15,7 +15,7 @@ module Nobject
|
|
15
15
|
Thread.new do
|
16
16
|
loop do
|
17
17
|
msg_size = @socket.recv(8).unpack('Q>').first
|
18
|
-
File.open('/tmp/nobject.log', 'a') {|f| f.puts " RMR
|
18
|
+
File.open('/tmp/nobject.log', 'a') {|f| f.puts " RMR:##{@msg_counter += 1} sz#{msg_size}"; f.flush }
|
19
19
|
msg = Marshal.load(@socket.recv(msg_size))
|
20
20
|
|
21
21
|
result = @obj.send(msg[:method], *msg[:args])
|
@@ -31,7 +31,7 @@ module Nobject
|
|
31
31
|
data_bytes = Marshal.dump(data)
|
32
32
|
|
33
33
|
@socket.send([data_bytes.length].pack('Q>'), 0)
|
34
|
-
File.open('/tmp/nobject.log', 'a') {|f| f.puts " RMResult
|
34
|
+
File.open('/tmp/nobject.log', 'a') {|f| f.puts " RMResult:##{@msg_counter += 1} sz#{data_bytes.length}"; f.flush }
|
35
35
|
@socket.send(data_bytes, 0)
|
36
36
|
end
|
37
37
|
end
|