public void StopUnixSocket()
{
// work around mono bug. listener.Dispose() should delete file, but it
// fails because there are null chars appended to the end of the filename
// for some reason.
// See: https://bugzilla.xamarin.com/show_bug.cgi?id=35004
var socketPath = ((UnixEndPoint)listener.LocalEndpoint).Filename;
var nullTerminatorIndex = socketPath.IndexOf('\0');
listener.Dispose();
if (nullTerminatorIndex > 0) {
try {
socketPath = socketPath.Remove(nullTerminatorIndex);
File.Delete(socketPath);
} catch {
// well, we tried
}
}
}