Write a file to the connection

If not path.file_exists, the method returns.

Property definitions

libevent $ Connection :: write_file
	# Write a file to the connection
	#
	# If `not path.file_exists`, the method returns.
	fun write_file(path: String)
	do
		if close_requested then return

		var file = new FileReader.open(path)
		if file.last_error != null then
			var error = new IOError("Failed to open file at '{path}'")
			error.cause = file.last_error
			self.last_error = error
			file.close
			return
		end

		var stat = file.file_stat
		if stat == null then
			last_error = new IOError("Failed to stat file at '{path}'")
			file.close
			return
		end

		var err = native_buffer_event.output_buffer.add_file(file.fd, 0, stat.size)
		if err then
			last_error = new IOError("Failed to add file at '{path}'")
			file.close
		end
	end
lib/libevent/libevent.nit:251,2--279,4