aboutsummaryrefslogtreecommitdiff
path: root/src/util/server.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-21 21:03:45 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-21 21:03:45 +0000
commit1e83b104b323d90664e90af7a12166308ba6ee7a (patch)
treea03f1585823fefa7d129a0bb11f62e87985668d5 /src/util/server.c
parent3c85fbac0a477a3f364da4eba7fe94a57d6eab1b (diff)
downloadgnunet-1e83b104b323d90664e90af7a12166308ba6ee7a.tar.gz
gnunet-1e83b104b323d90664e90af7a12166308ba6ee7a.zip
towards a new conveniance API
Diffstat (limited to 'src/util/server.c')
-rw-r--r--src/util/server.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/util/server.c b/src/util/server.c
index 036c8a441..adc19ecb7 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -1118,6 +1118,44 @@ GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
1118 1118
1119 1119
1120/** 1120/**
1121 * Ask the server to stop notifying us whenever a client disconnects.
1122 *
1123 * @param server the server manageing the clients
1124 * @param callback function to call on disconnect
1125 * @param callback_cls closure for callback
1126 */
1127void
1128GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server,
1129 GNUNET_SERVER_DisconnectCallback callback,
1130 void *callback_cls)
1131{
1132 struct NotifyList *pos;
1133 struct NotifyList *prev;
1134
1135 prev = NULL;
1136 pos = server->disconnect_notify_list;
1137 while (pos != NULL)
1138 {
1139 if ( (pos->callback == callback) &&
1140 (pos->callback_cls == callback_cls ) )
1141 break;
1142 prev = pos;
1143 pos = pos->next;
1144 }
1145 if (pos == NULL)
1146 {
1147 GNUNET_break (0);
1148 return;
1149 }
1150 if (prev == NULL)
1151 server->disconnect_notify_list = pos->next;
1152 else
1153 prev->next = pos->next;
1154 GNUNET_free (pos);
1155}
1156
1157
1158/**
1121 * Ask the server to disconnect from the given client. 1159 * Ask the server to disconnect from the given client.
1122 * This is the same as returning GNUNET_SYSERR from a message 1160 * This is the same as returning GNUNET_SYSERR from a message
1123 * handler, except that it allows dropping of a client even 1161 * handler, except that it allows dropping of a client even
@@ -1171,6 +1209,7 @@ GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
1171 * @param client client we were processing a message of 1209 * @param client client we were processing a message of
1172 * @param success GNUNET_OK to keep the connection open and 1210 * @param success GNUNET_OK to keep the connection open and
1173 * continue to receive 1211 * continue to receive
1212 * GNUNET_NO to close the connection (normal behavior)
1174 * GNUNET_SYSERR to close the connection (signal 1213 * GNUNET_SYSERR to close the connection (signal
1175 * serious error) 1214 * serious error)
1176 */ 1215 */