void *rn_cls;
};
-
/**
* Struct to refer to a GNUnet TCP connection.
* This is more than just a socket because if the server
}
-/**
- * If possible, write a shutdown message to the target
- * buffer and destroy the client connection.
- *
- * @param cls the "struct GNUNET_CLIENT_Connection" to destroy
- * @param size number of bytes available in buf
- * @param buf NULL on error, otherwise target buffer
- * @return number of bytes written to buf
- */
-static size_t
-write_shutdown (void *cls, size_t size, void *buf)
-{
- struct GNUNET_MessageHeader *msg;
- struct GNUNET_CLIENT_Connection *sock = cls;
-
- GNUNET_CLIENT_disconnect (sock, GNUNET_YES);
- if (size < sizeof (struct GNUNET_MessageHeader))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Failed to transmit shutdown request to client.\n"));
- return 0; /* client disconnected */
- }
- msg = (struct GNUNET_MessageHeader *) buf;
- msg->type = htons (GNUNET_MESSAGE_TYPE_SHUTDOWN);
- msg->size = htons (sizeof (struct GNUNET_MessageHeader));
- return sizeof (struct GNUNET_MessageHeader);
-}
-
-
-/**
- * Request that the service should shutdown.
- * Afterwards, the connection will automatically be
- * disconnected. Hence the "sock" should not
- * be used by the caller after this call
- * (calling this function frees "sock" after a while).
- *
- * @param sock the socket connected to the service
- */
-void
-GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock)
-{
- GNUNET_CONNECTION_notify_transmit_ready (sock->sock,
- sizeof (struct
- GNUNET_MessageHeader),
- GNUNET_TIME_UNIT_FOREVER_REL,
- &write_shutdown, sock);
-}
-
-
/**
* Report service unavailable.
*/
_("Failure to transmit TEST request.\n"));
#endif
service_test_error (conn->sched, conn->test_cb, conn->test_cb_cls);
+ GNUNET_CLIENT_disconnect (conn, GNUNET_NO);
return 0; /* client disconnected */
}
#if DEBUG_CLIENT