[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11893 - in gnunet/src: include transport util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11893 - in gnunet/src: include transport util |
Date: |
Wed, 23 Jun 2010 10:59:34 +0200 |
Author: grothoff
Date: 2010-06-23 10:59:34 +0200 (Wed, 23 Jun 2010)
New Revision: 11893
Modified:
gnunet/src/include/gnunet_server_lib.h
gnunet/src/transport/plugin_transport_http.c
gnunet/src/util/server.c
gnunet/src/util/server_mst.c
Log:
mst api fix
Modified: gnunet/src/include/gnunet_server_lib.h
===================================================================
--- gnunet/src/include/gnunet_server_lib.h 2010-06-23 08:58:06 UTC (rev
11892)
+++ gnunet/src/include/gnunet_server_lib.h 2010-06-23 08:59:34 UTC (rev
11893)
@@ -529,7 +529,6 @@
*/
struct GNUNET_SERVER_MessageStreamTokenizer *
GNUNET_SERVER_mst_create (size_t maxbuf,
- void *client_identity,
GNUNET_SERVER_MessageTokenizerCallback cb,
void *cb_cls);
@@ -550,6 +549,7 @@
*/
int
GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
+ void *client_identity,
const char *buf,
size_t size,
int purge,
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2010-06-23 08:58:06 UTC
(rev 11892)
+++ gnunet/src/transport/plugin_transport_http.c 2010-06-23 08:59:34 UTC
(rev 11893)
@@ -509,7 +509,7 @@
}
*/
if (cs->msgtok==NULL)
- cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
cs, &messageTokenizerCallback, cs);
+ cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
&messageTokenizerCallback, cs);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s'
request from peer `%s'\n",method, GNUNET_i2s(&cs->partner));
}
@@ -579,7 +579,7 @@
if (cs->pending_inbound_msg->pos >= sizeof (struct GNUNET_MessageHeader))
{
cur_msg = (struct GNUNET_MessageHeader *) cs->pending_inbound_msg->buf;
- res =
GNUNET_SERVER_mst_receive(cs->msgtok,cs->pending_inbound_msg->buf,cs->pending_inbound_msg->pos,
GNUNET_YES, GNUNET_NO);
+ res = GNUNET_SERVER_mst_receive(cs->msgtok, cs,
cs->pending_inbound_msg->buf,cs->pending_inbound_msg->pos, GNUNET_YES,
GNUNET_NO);
if ((res != GNUNET_SYSERR) && (res != GNUNET_NO))
send_error_to_client = GNUNET_NO;
}
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2010-06-23 08:58:06 UTC (rev 11892)
+++ gnunet/src/util/server.c 2010-06-23 08:59:34 UTC (rev 11893)
@@ -675,7 +675,7 @@
#if DEBUG_SERVER
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server processes additional
messages instantly.\n");
#endif
- ret = GNUNET_SERVER_mst_receive (client->mst, NULL, 0, GNUNET_NO,
GNUNET_YES);
+ ret = GNUNET_SERVER_mst_receive (client->mst, client, NULL, 0,
GNUNET_NO, GNUNET_YES);
}
#if DEBUG_SERVER
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -743,7 +743,7 @@
#endif
GNUNET_SERVER_client_keep (client);
client->last_activity = GNUNET_TIME_absolute_get ();
- ret = GNUNET_SERVER_mst_receive (client->mst, buf, available, GNUNET_NO,
GNUNET_YES);
+ ret = GNUNET_SERVER_mst_receive (client->mst, client, buf, available,
GNUNET_NO, GNUNET_YES);
process_mst (client, ret);
}
@@ -844,7 +844,6 @@
client = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Client));
client->connection = connection;
client->mst = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
- client,
&client_message_tokenizer_callback,
server);
client->reference_count = 1;
Modified: gnunet/src/util/server_mst.c
===================================================================
--- gnunet/src/util/server_mst.c 2010-06-23 08:58:06 UTC (rev 11892)
+++ gnunet/src/util/server_mst.c 2010-06-23 08:59:34 UTC (rev 11893)
@@ -57,11 +57,6 @@
void *cb_cls;
/**
- * Client to pass to cb.
- */
- void *client_identity;
-
- /**
* Size of the buffer (starting at 'hdr').
*/
size_t maxbuf;
@@ -90,15 +85,12 @@
*
* @param maxbuf maximum message size to support (typically
* GNUNET_SERVER_MAX_MESSAGE_SIZE)
- * @param client_identity ID of client for which this is a buffer,
- * can be NULL (will be passed back to 'cb')
* @param cb function to call on completed messages
* @param cb_cls closure for cb
* @return handle to tokenizer
*/
struct GNUNET_SERVER_MessageStreamTokenizer *
GNUNET_SERVER_mst_create (size_t maxbuf,
- void *client_identity,
GNUNET_SERVER_MessageTokenizerCallback cb,
void *cb_cls)
{
@@ -106,7 +98,6 @@
ret = GNUNET_malloc (maxbuf + sizeof (struct
GNUNET_SERVER_MessageStreamTokenizer));
ret->maxbuf = maxbuf;
- ret->client_identity = client_identity;
ret->cb = cb;
ret->cb_cls = cb_cls;
return ret;
@@ -118,6 +109,7 @@
* callback for all complete messages.
*
* @param mst tokenizer to use
+ * @param client_identity ID of client for which this is a buffer
* @param buf input data to add
* @param size number of bytes in buf
* @param purge should any excess bytes in the buffer be discarded
@@ -129,6 +121,7 @@
*/
int
GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
+ void *client,
const char *buf,
size_t size,
int purge,
@@ -228,7 +221,7 @@
}
if (one_shot == GNUNET_YES)
one_shot = GNUNET_SYSERR;
- mst->cb (mst->cb_cls, mst->client_identity, hdr);
+ mst->cb (mst->cb_cls, client, hdr);
mst->off += want;
if (mst->off == mst->pos)
{
@@ -264,7 +257,7 @@
}
if (one_shot == GNUNET_YES)
one_shot = GNUNET_SYSERR;
- mst->cb (mst->cb_cls, mst->client_identity, hdr);
+ mst->cb (mst->cb_cls, client, hdr);
buf += want;
size -= want;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11893 - in gnunet/src: include transport util,
gnunet <=