diff options
authorYorhel <>2015-07-21 01:00:41 +0200
committerYorhel <>2015-07-21 01:00:41 +0200
commit7605b38f304f043b1a0947278eca12daad32a608 (patch)
parentc720511e81fe093175926e9ba06cb857a763b4a3 (diff)
Multi::API: Support IPv6
This was more trivial than I had expected. I already took ipv6 into account when rewriting the API for AnyEvent (including the use of norm_ip()), so that part was fine. The only part I had to fix was the listening socket, and I had to ensure that the $c->{ip} was correct. The first was easy, and the latter was properly handled by AnyEvent automatically. Looks like AnyEvent automatically 'unpacks' IPv4-mapped IPv6 addresses, so I didn't have to deal with that myself.
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Multi/ b/lib/Multi/
index 2385e11d..cce366d1 100644
--- a/lib/Multi/
+++ b/lib/Multi/
@@ -55,7 +55,11 @@ sub run {
%O = (%O, @_);
- push_watcher tcp_server undef, $O{port}, \&newconn;
+ push_watcher tcp_server '::', $O{port}, \&newconn;
+ # The following tcp_server will fail if the above already bound to IPv4.
+ eval {
+ push_watcher tcp_server 0, $O{port}, \&newconn;
+ };
writelog 'API starting up on port %d', $O{port};