cakedb 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cakedb.rb +4 -4
- metadata +1 -1
data/lib/cakedb.rb
CHANGED
@@ -15,7 +15,7 @@ class CakeDB
|
|
15
15
|
@server.write [stream.bytesize,5].pack("L>S>")
|
16
16
|
@server.write stream
|
17
17
|
@server.flush
|
18
|
-
sid =
|
18
|
+
sid = data_in(2).unpack("S>")
|
19
19
|
@sids[stream] = sid[0]
|
20
20
|
return sid[0]
|
21
21
|
else
|
@@ -41,12 +41,12 @@ class CakeDB
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def data_in(length)
|
44
|
-
data
|
44
|
+
data = @server.recv(length)
|
45
45
|
got = data.bytesize
|
46
46
|
timeOver = Time.now + @timeout
|
47
47
|
while got < length
|
48
48
|
data += @server.recv(length-got)
|
49
|
-
got
|
49
|
+
got = data.bytesize
|
50
50
|
if Time.now > timeOver
|
51
51
|
raise "Timeout on incomplete read, returning what I had"
|
52
52
|
if @loggingLevel == 1
|
@@ -90,7 +90,7 @@ class CakeDB
|
|
90
90
|
#recieve the data, header says how much
|
91
91
|
result[counter] = Hash.new
|
92
92
|
result[counter]["ts"] = header[0]
|
93
|
-
result[counter]["data"] =
|
93
|
+
result[counter]["data"] = data_in(header[1])
|
94
94
|
recv_total = recv_total - header[1] - 12
|
95
95
|
counter+=1
|
96
96
|
end
|