[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5531 - GNUnet/src/transports
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5531 - GNUnet/src/transports |
Date: |
Thu, 23 Aug 2007 18:34:49 -0600 (MDT) |
Author: grothoff
Date: 2007-08-23 18:34:28 -0600 (Thu, 23 Aug 2007)
New Revision: 5531
Modified:
GNUnet/src/transports/http.c
Log:
twt
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2007-08-22 19:36:17 UTC (rev 5530)
+++ GNUnet/src/transports/http.c 2007-08-24 00:34:28 UTC (rev 5531)
@@ -1367,7 +1367,54 @@
return OK;
}
+
/**
+ * Test if the transport would even try to send
+ * a message of the given size and importance
+ * for the given session.<br>
+ * This function is used to check if the core should
+ * even bother to construct (and encrypt) this kind
+ * of message.
+ *
+ * @return YES if the transport would try (i.e. queue
+ * the message or call the OS to send),
+ * NO if the transport would just drop the message,
+ * SYSERR if the size/session is invalid
+ */
+static int
+httpTestWouldTry (TSession * tsession, const unsigned int size, int important)
+{
+ HTTPSession *httpSession = tsession->internal;
+
+ if (size >= MAX_BUFFER_SIZE - sizeof (MESSAGE_HEADER))
+ {
+ GE_BREAK (coreAPI->ectx, 0);
+ return SYSERR;
+ }
+ if (size == 0)
+ {
+ GE_BREAK (coreAPI->ectx, 0);
+ return SYSERR;
+ }
+ if (httpSession->is_client) {
+ /* client */
+ if ( (important != YES) &&
+ (httpSession->cs.client.puts != NULL) )
+ return NO;
+ return YES;
+ } else {
+ /* server */
+ if (httpSession->cs.server.wsize == 0)
+ return YES;
+ if ( (httpSession->cs.server.wpos + size > httpSession->cs.server.wsize) &&
+ (important != YES) )
+ return NO;
+ return YES;
+ }
+}
+
+
+/**
* Send a message to the specified remote node.
*
* @param tsession the P2P_hello_MESSAGE identifying the remote node
@@ -1894,6 +1941,7 @@
httpAPI.startTransportServer = &startTransportServer;
httpAPI.stopTransportServer = &stopTransportServer;
httpAPI.helloToAddress = &helloToAddress;
+ httpAPI.testWouldTry = &httpTestWouldTry;
return &httpAPI;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5531 - GNUnet/src/transports,
gnunet <=