Merge pull request #93 from vibe-d/issue78-avoid-libanl-dependency

Remove the default dependency to libanl
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2018-11-11 14:28:54 +01:00 committed by GitHub
commit 19a8fc64c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

10
dub.sdl
View file

@ -5,7 +5,7 @@ copyright "Copyright © 2016-2018 Sönke Ludwig"
targetType "library" targetType "library"
libs "anl" "resolv" platform="linux" libs "resolv" platform="linux"
libs "ws2_32" "user32" platform="windows-dmd" libs "ws2_32" "user32" platform="windows-dmd"
dependency "taggedalgebraic" version="~>0.10.12" dependency "taggedalgebraic" version="~>0.10.12"
@ -15,6 +15,14 @@ configuration "epoll" {
versions "EventcoreEpollDriver" versions "EventcoreEpollDriver"
} }
// getaddrinfo_a based DNS lookups
configuration "epoll-gaia" {
libs "anl"
versions "EventcoreUseGAIA"
platforms "linux"
versions "EventcoreEpollDriver"
}
configuration "kqueue" { configuration "kqueue" {
platforms "osx" "freebsd" platforms "osx" "freebsd"
versions "EventcoreKqueueDriver" versions "EventcoreKqueueDriver"

View file

@ -158,6 +158,7 @@ final class EventDriverDNS_GAIA(Events : EventDriverEvents, Signals : EventDrive
DNSLookupCallback callback; DNSLookupCallback callback;
} }
ChoppedVector!Lookup m_lookups; ChoppedVector!Lookup m_lookups;
Events m_events;
Signals m_signals; Signals m_signals;
int m_dnsSignal; int m_dnsSignal;
SignalListenID m_sighandle; SignalListenID m_sighandle;
@ -167,6 +168,7 @@ final class EventDriverDNS_GAIA(Events : EventDriverEvents, Signals : EventDrive
this(Events events, Signals signals) this(Events events, Signals signals)
{ {
m_events = events;
m_signals = signals; m_signals = signals;
m_dnsSignal = () @trusted { return SIGRTMIN; } (); m_dnsSignal = () @trusted { return SIGRTMIN; } ();
m_sighandle = signals.listenInternal(m_dnsSignal, &onDNSSignal); m_sighandle = signals.listenInternal(m_dnsSignal, &onDNSSignal);
@ -214,6 +216,8 @@ final class EventDriverDNS_GAIA(Events : EventDriverEvents, Signals : EventDrive
{ {
assert(status == SignalStatus.ok); assert(status == SignalStatus.ok);
foreach (i, ref l; m_lookups) { foreach (i, ref l; m_lookups) {
scope (failure) assert(false);
if (!l.callback) continue; if (!l.callback) continue;
auto err = gai_error(&l.ctx); auto err = gai_error(&l.ctx);
if (err == EAI_INPROGRESS) continue; if (err == EAI_INPROGRESS) continue;
@ -243,6 +247,8 @@ final class EventDriverDNS_GAIA(Events : EventDriverEvents, Signals : EventDrive
version (linux) extern(C) { version (linux) extern(C) {
import core.sys.posix.signal : sigevent; import core.sys.posix.signal : sigevent;
nothrow @nogc:
struct gaicb { struct gaicb {
const(char)* ar_name; const(char)* ar_name;
const(char)* ar_service; const(char)* ar_service;

View file

@ -45,7 +45,7 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver {
alias TimerDriver = LoopTimeoutTimerDriver; alias TimerDriver = LoopTimeoutTimerDriver;
alias SocketsDriver = PosixEventDriverSockets!Loop; alias SocketsDriver = PosixEventDriverSockets!Loop;
version (Windows) alias DNSDriver = EventDriverDNS_GHBN!(EventsDriver, SignalsDriver); version (Windows) alias DNSDriver = EventDriverDNS_GHBN!(EventsDriver, SignalsDriver);
//version (linux) alias DNSDriver = EventDriverDNS_GAIA!(EventsDriver, SignalsDriver); else version (EventcoreUseGAIA) alias DNSDriver = EventDriverDNS_GAIA!(EventsDriver, SignalsDriver);
else alias DNSDriver = EventDriverDNS_GAI!(EventsDriver, SignalsDriver); else alias DNSDriver = EventDriverDNS_GAI!(EventsDriver, SignalsDriver);
alias FileDriver = ThreadedFileEventDriver!EventsDriver; alias FileDriver = ThreadedFileEventDriver!EventsDriver;
version (linux) alias WatcherDriver = InotifyEventDriverWatchers!EventsDriver; version (linux) alias WatcherDriver = InotifyEventDriverWatchers!EventsDriver;