cakedb 0.0.7 → 0.0.8
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.
- data/lib/cakedb.rb +5 -4
- metadata +1 -1
data/lib/cakedb.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
require 'socket'
|
4
4
|
|
5
5
|
class CakeDB
|
6
|
-
def initialize( server="127.0.0.1", port=8888,
|
6
|
+
def initialize( server="127.0.0.1", port=8888, lvl=0 )
|
7
7
|
#puts "Connection Initiated"
|
8
8
|
@server = TCPSocket.new(server, port)
|
9
9
|
@sids = {}
|
10
|
+
@@loggingLevel = lvl
|
10
11
|
end
|
11
12
|
def get_sid(stream)
|
12
13
|
if @sids[stream].nil?
|
@@ -62,13 +63,13 @@ class CakeDB
|
|
62
63
|
header_whole = @server.recv(12)
|
63
64
|
header = header_whole.unpack("Q>L>")
|
64
65
|
if header[0] == nil || header[1] == nil
|
65
|
-
if loggingLevel == 1
|
66
|
+
if @loggingLevel == 1
|
66
67
|
puts "You have been eaten by a Grue"
|
67
68
|
end
|
68
69
|
raise "You have been eaten by a Grue"
|
69
70
|
end
|
70
71
|
if header_whole.bytesize !=12
|
71
|
-
if loggingLevel == 1
|
72
|
+
if @loggingLevel == 1
|
72
73
|
puts "Incomplete header"
|
73
74
|
puts "Length: #{header[1]}"
|
74
75
|
puts "TS: #{header[0]}"
|
@@ -87,7 +88,7 @@ class CakeDB
|
|
87
88
|
puts "Incomplete read: #{result[counter]["data"].bytesize} / #{header[1]}"
|
88
89
|
end
|
89
90
|
if result[counter]["data"].bytesize != header[1]
|
90
|
-
if loggingLevel ==
|
91
|
+
if @loggingLevel == 2
|
91
92
|
puts "Incomplete read on payload receive"
|
92
93
|
puts "Raw Data: #{resultt[counter]}"
|
93
94
|
puts "Length: #{header[1]} bytes"
|