Method: Le::Host::HTTP#run

Defined in:
lib/le/host/http.rb

#runObject



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/le/host/http.rb', line 262

def run
  reopenConnection

  loop do
    data = @queue.pop
    break if data == SHUTDOWN_COMMAND
    loop do
      begin
        @conn.write(data)
      rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, EOFError
        dbg "LE: Connection timeout(#{ $! }), try to reopen connection"
        reopenConnection
        next
      rescue
        dbg("LE: Got exception in run loop - #{ $! }")
        raise
      end

      break
    end
  end

  dbg "LE: Closing Asynchronous socket writer"

  closeConnection
end