class PhusionPassenger::AnalyticsLogger::Connection

def connected?

def connected?
	return !!@channel
end

def disconnect

def disconnect
	@channel.close if @channel
	@channel = nil
end

def initialize(io)

def initialize(io)
	@mutex = Mutex.new
	@refcount = 1
	@channel = MessageChannel.new(io) if io
end

def ref

def ref
	@refcount += 1
end

def synchronize

def synchronize
	@mutex.synchronize do
		yield
	end
end

def unref

def unref
	@refcount -= 1
	if @refcount == 0
		disconnect
	end
end