Author: ArcRiley Date: 2009-01-07 14:14:02 -0500 (Wed, 07 Jan 2009) New Revision: 1435
Modified: trunk/concordance/src/Core.c Log: removed trailing spaces Modified: trunk/concordance/src/Core.c =================================================================== --- trunk/concordance/src/Core.c 2009-01-07 18:51:33 UTC (rev 1434) +++ trunk/concordance/src/Core.c 2009-01-07 19:14:02 UTC (rev 1435) @@ -32,7 +32,7 @@ static void conCore_xmlEnd (gpointer, const XML_Char*); static void conCore_xmlCharData (gpointer, const XML_Char*, gint); - /*\ + /*\ cdef class Core : \*/ static char conCore_Doc[] = "Test"; @@ -81,19 +81,19 @@ xmpp-server 5269/tcp # XMPP Server Connection XEP-0035 (SSL/TLS Integration) : - Traditionally, Jabber servers has supported TLS by utilising a - "wrapper" around the standard protocol stream. This wrapper usually - listens on a port other than those listed in the IANA registry - (commonly 5223 for client-to-server communications and 5270 for - server-to-server communications). In the case of client-to-server - communications, clients must initiate a TLS session immediately after - connecting, before beginning the normal XML stream. This method of - utilising TLS is typical of many servers that implement stream-based - protocols, but has a number of flaws, which are outlined in section 7 - of RFC 2595. Accordingly, the use of port 5223 and port 5270 for + Traditionally, Jabber servers has supported TLS by utilising a + "wrapper" around the standard protocol stream. This wrapper usually + listens on a port other than those listed in the IANA registry + (commonly 5223 for client-to-server communications and 5270 for + server-to-server communications). In the case of client-to-server + communications, clients must initiate a TLS session immediately after + connecting, before beginning the normal XML stream. This method of + utilising TLS is typical of many servers that implement stream-based + protocols, but has a number of flaws, which are outlined in section 7 + of RFC 2595. Accordingly, the use of port 5223 and port 5270 for secure sessions is deprecated. - Thus, we use only two listening sockets; one for clients, one for + Thus, we use only two listening sockets; one for clients, one for servers. If additional ports are required (ie, for IPv6 support) it's recommended to run multiple servers or one server with multiple cores. */ @@ -105,35 +105,35 @@ /* parse arguments and keywords From http://docs.python.org/3.0/c-api/arg.html : - | Indicates that the remaining arguments in the Python argument list - are optional. The C variables corresponding to optional arguments - should be initialized to their default value — when an optional - argument is not specified, PyArg_ParseTuple does not touch the + | Indicates that the remaining arguments in the Python argument list + are optional. The C variables corresponding to optional arguments + should be initialized to their default value — when an optional + argument is not specified, PyArg_ParseTuple does not touch the contents of the corresponding C variable(s). - () The object must be a Python sequence whose length is the number of - format units in items. The C arguments must correspond to the - individual format units in items. Format units for sequences may + () The object must be a Python sequence whose length is the number of + format units in items. The C arguments must correspond to the + individual format units in items. Format units for sequences may be nested. - s Convert a Python string or Unicode object to a C pointer to a - character string. You must not provide storage for the string - itself; a pointer to an existing string is stored into the - character pointer variable whose address you pass. The C string is - NUL-terminated. The Python string must not contain embedded NUL - bytes; if it does, a TypeError exception is raised. Unicode - objects are converted to C strings using the default encoding. If + s Convert a Python string or Unicode object to a C pointer to a + character string. You must not provide storage for the string + itself; a pointer to an existing string is stored into the + character pointer variable whose address you pass. The C string is + NUL-terminated. The Python string must not contain embedded NUL + bytes; if it does, a TypeError exception is raised. Unicode + objects are converted to C strings using the default encoding. If this conversion fails, a UnicodeError is raised. - H Convert a Python integer to a C unsigned short int, without + H Convert a Python integer to a C unsigned short int, without overflow checking. - : The list of format units ends here; the string after the colon is - used as the function name in error messages (the “associated + : The list of format units ends here; the string after the colon is + used as the function name in error messages (the “associated value” of the exception that PyArg_ParseTuple raises). */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|(sH)(sH):Core", kwlist, - &self->c2s.addr, &self->c2s.port, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|(sH)(sH):Core", kwlist, + &self->c2s.addr, &self->c2s.port, &self->s2s.addr, &self->s2s.port)) return -1; - /* We use a non-default context to avoid conflict with other glib-based + /* We use a non-default context to avoid conflict with other glib-based Python packages which may have their own GMainLoop in other threads. GMainContext* g_main_context_new (void); @@ -142,7 +142,7 @@ /* open the listening channels - Note that the sockets default to -1 and remain -1 on failure, the + Note that the sockets default to -1 and remain -1 on failure, the dealloc function uses this (if != -1) to close open all sockets. listenchannel (see below) will set the Python error message on failure. @@ -196,14 +196,14 @@ static int conCore_setattro(conCoreObject* self, PyObject* key, PyObject* value) { return PyObject_GenericSetAttr((PyObject*) self, key, value); - } + } /* # ########################################################################### # # MainLoop thread functions (nogil) - # */ + # */ static gpointer conCore_loop(gpointer s) { /*\ @@ -221,7 +221,7 @@ } - static int + static int conCore_listenChannel(conCoreObject* self, conChannel* sock) { /*\ cdef : \*/ int ret; @@ -237,12 +237,12 @@ ret = getaddrinfo(sock->addr, NULL, NULL, &resinfo); if (ret != 0) { switch (ret) { - case EAI_AGAIN : + case EAI_AGAIN : /* EAI_AGAIN The name server returned a temporary failure indication. Try again later. */ PyErr_SetString(PyExc_OSError, "temporary dns failure"); - case EAI_FAIL : + case EAI_FAIL : /* EAI_FAIL The name server returned a permanent failure indication. */ PyErr_SetString(PyExc_OSError, "permanent dns failure"); @@ -268,7 +268,7 @@ /* Copy port into sockaddr struct uint16_t htons(uint16_t hostshort); - The htons() function converts the unsigned short integer hostshort + The htons() function converts the unsigned short integer hostshort from host byte order to network byte order. */ ((struct sockaddr_in*) resinfo->ai_addr)->sin_port = htons(sock->port); @@ -283,7 +283,7 @@ if (sock->sock > -1) { /* Bind and Listen to opened socket - int bind(int fd, const struct sockaddr *addr, + int bind(int fd, const struct sockaddr *addr, socklen_t addrlen); On success, zero is returned. On error, -1 is returned. @@ -302,7 +302,7 @@ GMainContext* context); */ sock->chan = conAddSocket(sock->sock, G_IO_IN, - (GSourceFunc)conCore_listenNew, + (GSourceFunc)conCore_listenNew, (gpointer) self, self->context); ret = TRUE; } @@ -310,7 +310,7 @@ PyErr_SetString(PyExc_OSError, "unable to bind listening socket"); ret = FALSE; } - } + } else { PyErr_SetString(PyExc_OSError, "unable to bind listening socket"); ret = FALSE; @@ -380,7 +380,7 @@ ########################################################################### # # Channel Callbacks - # */ + # */ static gboolean conCore_listenNew(GIOChannel* sourceChannel, GIOCondition condition, @@ -397,7 +397,7 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); */ - if ((fd = accept(g_io_channel_unix_get_fd(sourceChannel), + if ((fd = accept(g_io_channel_unix_get_fd(sourceChannel), &addr, &addrlen))<0) return TRUE; @@ -473,8 +473,8 @@ XML_SetUserData(newSession->pars, newSession); XML_SetElementHandler(newSession->pars, conCore_xmlStart, conCore_xmlEnd); XML_SetCharacterDataHandler(newSession->pars, conCore_xmlCharData); - + /* add new channel to the channels hashtable void g_hash_table_insert (GHashTable *hash_table, @@ -531,7 +531,7 @@ } } printf("Shutting down\n"); - /* G_IO_EOF, read EOF, or an unknown channel error has occured + /* G_IO_EOF, read EOF, or an unknown channel error has occured GIOStatus g_io_channel_shutdown (GIOChannel *channel, gboolean flush, @@ -542,7 +542,7 @@ /* close out parser cleanly - void XML_ParserFree (XML_Parser parser); + void XML_ParserFree (XML_Parser parser); */ XML_Parse(session->pars, NULL, 0, TRUE); XML_ParserFree(session->pars); @@ -567,7 +567,7 @@ gconstpointer key); */ session = g_hash_table_lookup(self->channels, channel); - + /* send as much data as the channel will take GIOStatus g_io_channel_write_chars (GIOChannel *channel, @@ -585,7 +585,7 @@ gssize pos, gssize len); */ - session->buff = g_string_erase(session->buff, 0, sent); + session->buff = g_string_erase(session->buff, 0, sent); /* keep this event alive only if there's more in the buffer to write */ return (session->buff->len != 0); @@ -597,7 +597,7 @@ ########################################################################### # # XML Callbacks - # */ + # */ static void conCore_xmlStart(gpointer s, const XML_Char* name, const XML_Char** atts) { /*\ @@ -693,7 +693,7 @@ ########################################################################### # # Class Methods and Type - # */ + # */ static PyMethodDef conCore_methods[] = { { NULL, NULL }, @@ -721,7 +721,7 @@ (getattrofunc) conCore_getattro, /*tp_getattro*/ (setattrofunc) conCore_setattro, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | /*tp_flags*/ + Py_TPFLAGS_DEFAULT | /*tp_flags*/ Py_TPFLAGS_BASETYPE, conCore_Doc, /*tp_doc*/ 0, /*tp_traverse*/ _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn