rubtella 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.
- data/VERSION +1 -1
- data/bin/rubtella +2 -1
- data/lib/rubtella/rubtella.rb +12 -3
- data/rubtella.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bin/rubtella
CHANGED
data/lib/rubtella/rubtella.rb
CHANGED
@@ -103,7 +103,6 @@ module Rubtella
|
|
103
103
|
@@logger.info 'connection established'
|
104
104
|
@connected = @peer
|
105
105
|
@@logger.info "Connected with #{@connected.ip} #{@connected.port}"
|
106
|
-
@@logger.info "Connected with #{@connected.ip} #{@connected.port}"
|
107
106
|
|
108
107
|
manage_connection stream
|
109
108
|
else
|
@@ -114,8 +113,8 @@ module Rubtella
|
|
114
113
|
end
|
115
114
|
rescue Timeout::Error,Errno::ECONNREFUSED
|
116
115
|
@@logger.info "Timeout"
|
117
|
-
@peer =
|
118
|
-
|
116
|
+
@peer = @peers.shift
|
117
|
+
retry
|
119
118
|
rescue => e
|
120
119
|
@@logger.info e.to_s
|
121
120
|
end
|
@@ -156,6 +155,16 @@ module Rubtella
|
|
156
155
|
|
157
156
|
end
|
158
157
|
|
158
|
+
def send_ping
|
159
|
+
stream = TCPSocket.new @connected.ip, @connected.port
|
160
|
+
query = TCPData::Builder::Ping.new
|
161
|
+
@@logger.info "sending ping"
|
162
|
+
stream.send query.build, 0
|
163
|
+
@@logger.info 'we\'re listening..'
|
164
|
+
resp = stream.recv 1000
|
165
|
+
parse(resp)
|
166
|
+
end
|
167
|
+
|
159
168
|
def send_query(text)
|
160
169
|
stream = TCPSocket.new @connected.ip, @connected.port
|
161
170
|
query = TCPData::Builder::Query.new(:criteria => text)
|
data/rubtella.gemspec
CHANGED