Listen on a UNIX domain socket for new connections

On new connections, libevent callbacks spawn_connection.

Property definitions

libevent $ ConnectionFactory :: bind_unix
	# Listen on a UNIX domain socket for new connections
	#
	# On new connections, libevent callbacks `spawn_connection`.
	fun bind_unix(path: String): nullable ConnectionListener
	do
		# Delete the socket if it already exists
		var stat = path.file_stat
		if stat != null and stat.is_sock then path.file_delete

		var listener = new ConnectionListener.bind_unix(
			event_base, path.to_cstring, self)

		if listener.address_is_null then
			print_error "libevent warning: Opening UNIX domain socket {path} failed, " +
				evutil_socket_error_to_string(evutil_socket_error).to_s
			return null
		end

		return listener
	end
lib/libevent/libevent.nit:531,2--550,4