[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Untested and likely buggy code to limit bandwidth usage...



Update of /home/minion/cvsroot/src/minion/src
In directory moria.mit.edu:/tmp/cvs-serv1148/src

Modified Files:
	tls.c 
Log Message:
Untested and likely buggy code to limit bandwidth usage and number of concurrent outgoing connections

Index: tls.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/tls.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- tls.c	17 Jan 2004 04:22:44 -0000	1.32
+++ tls.c	6 Feb 2004 23:14:28 -0000	1.33
@@ -739,33 +739,25 @@
         return Py_None;
 }
 
-static char mm_TLSSock_get_num_bytes_raw__doc__[] = 
+static char mm_TLSSock_get_num_bytes_raw__doc__[] =
 "tlssock.get_num_bytes_raw()\n\n"
-"DOCDOC";
+"Return a total number of bytes read and written for this TLS connection\n";
+
 
 static PyObject*
 mm_TLSSock_get_num_bytes_raw(PyObject *self, PyObject* args, PyObject *kwargs)
 {
         SSL *ssl;
-        long r, w;
+        unsigned long r, w;
         PyObject *tup;
         assert(mm_TLSSock_Check(self));
         FAIL_IF_ARGS();
         ssl = ((mm_TLSSock*)self)->ssl;
-        r = (long) BIO_number_read(SSL_get_rbio(ssl));
-        w = (long) BIO_number_written(SSL_get_wbio(ssl));
-
-        if (!(tup = PyTuple_New(2))) {
-                PyErr_NoMemory();
-                return NULL;
-        }
-        PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(r));
-        PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(w));
-
-        return tup;
+        r = BIO_number_read(SSL_get_rbio(ssl));
+        w = BIO_number_written(SSL_get_wbio(ssl));
+        return PyInt_FromLong((long)(r+w));
 }
 
-
 #if 0
 static char mm_TLSSock_get_num_renegotiations__doc__[] =
 "tlssock.get_num_renegotiations()\n\n";