[CalendarServer-changes] [8949] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 29 00:35:02 PDT 2012
Revision: 8949
http://trac.macosforge.org/projects/calendarserver/changeset/8949
Author: glyph at apple.com
Date: 2012-03-29 00:35:00 -0700 (Thu, 29 Mar 2012)
Log Message:
-----------
Server support for IPv6 listening sockets.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
CalendarServer/trunk/twext/internet/sendfdport.py
CalendarServer/trunk/twext/python/sendmsg.c
Property Changed:
----------------
CalendarServer/trunk/
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2012-03-28 22:41:11 UTC (rev 8948)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2012-03-29 07:35:00 UTC (rev 8949)
@@ -862,11 +862,12 @@
def _allBindAddresses(self):
"""
An empty array for the config value of BindAddresses should be
- equivalent a BindAddresses with a single empty string, meaning "bind
- everything".
+ equivalent to an array containing two BindAddresses; one with a single
+ empty string, and one with "::", meaning "bind everything on both IPv4
+ and IPv6".
"""
if not config.BindAddresses:
- config.BindAddresses = [""]
+ config.BindAddresses = ["", "::"]
return config.BindAddresses
Modified: CalendarServer/trunk/twext/internet/sendfdport.py
===================================================================
--- CalendarServer/trunk/twext/internet/sendfdport.py 2012-03-28 22:41:11 UTC (rev 8948)
+++ CalendarServer/trunk/twext/internet/sendfdport.py 2012-03-29 07:35:00 UTC (rev 8949)
@@ -22,8 +22,8 @@
from os import close
from errno import EAGAIN, ENOBUFS
-from socket import (socketpair, fromfd, error as SocketError,
- AF_INET, AF_UNIX, SOCK_STREAM, SOCK_DGRAM)
+from socket import (socketpair, fromfd, error as SocketError, AF_UNIX,
+ SOCK_STREAM, SOCK_DGRAM)
from twisted.python import log
@@ -32,6 +32,7 @@
from twext.python.sendmsg import sendmsg, recvmsg
from twext.python.sendfd import sendfd, recvfd
+from twext.python.sendmsg import getsockfam
class InheritingProtocol(Protocol, object):
"""
@@ -273,7 +274,7 @@
raise
else:
try:
- skt = fromfd(fd, AF_INET, SOCK_STREAM)
+ skt = fromfd(fd, getsockfam(fd), SOCK_STREAM)
# XXX it could be AF_UNIX, I guess? or even something else?
# should this be on the transportFactory's side of things?
Modified: CalendarServer/trunk/twext/python/sendmsg.c
===================================================================
--- CalendarServer/trunk/twext/python/sendmsg.c 2012-03-28 22:41:11 UTC (rev 8948)
+++ CalendarServer/trunk/twext/python/sendmsg.c 2012-03-29 07:35:00 UTC (rev 8949)
@@ -42,12 +42,15 @@
static PyObject *sendmsg_sendmsg(PyObject *self, PyObject *args, PyObject *keywds);
static PyObject *sendmsg_recvmsg(PyObject *self, PyObject *args, PyObject *keywds);
+static PyObject *sendmsg_getsockfam(PyObject *self, PyObject *args, PyObject *keywds);
static PyMethodDef sendmsg_methods[] = {
{"sendmsg", (PyCFunction) sendmsg_sendmsg, METH_VARARGS | METH_KEYWORDS,
NULL},
{"recvmsg", (PyCFunction) sendmsg_recvmsg, METH_VARARGS | METH_KEYWORDS,
NULL},
+ {"getsockfam", (PyCFunction) sendmsg_getsockfam,
+ METH_VARARGS | METH_KEYWORDS, NULL},
{NULL, NULL, 0, NULL}
};
@@ -404,3 +407,23 @@
return final_result;
}
+static PyObject *sendmsg_getsockfam(PyObject *self, PyObject *args,
+ PyObject *keywds) {
+ int fd;
+ struct sockaddr sa;
+ static char *kwlist[] = {"fd", NULL};
+ if (!PyArg_ParseTupleAndKeywords(args, keywds, "i", kwlist, &fd)) {
+ return NULL;
+ }
+ socklen_t sz = sizeof(sa);
+ if (getsockname(fd, &sa, &sz)) {
+ PyErr_SetFromErrno(sendmsg_socket_error);
+ return NULL;
+ }
+ PyObject *rval;
+ if ((rval = Py_BuildValue("i", sa.sa_family)) == NULL) {
+ return NULL;
+ }
+ Py_DECREF(rval);
+ return rval;
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120329/08392284/attachment-0001.html>
More information about the calendarserver-changes
mailing list