summaryrefslogtreecommitdiff
path: root/tests/anonself.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-16 14:05:05 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-16 14:30:36 +0200
commitc315d80395b3507c7e7e1cf5bfa821ed0c434980 (patch)
tree3ba9cd7336225f9f7b8327f584c98848208e1530 /tests/anonself.c
parent8af2a5d24a3e28b579211a8706a056f85ca4e0fa (diff)
downloadgnutls-c315d80395b3507c7e7e1cf5bfa821ed0c434980.tar.gz
gnutls_packet_get() was introduced to avoid exporting a structure on the API.
That change will allow exporting more info associated with a packet in the future.
Diffstat (limited to 'tests/anonself.c')
-rw-r--r--tests/anonself.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/anonself.c b/tests/anonself.c
index 330600ee72..12f0df992b 100644
--- a/tests/anonself.c
+++ b/tests/anonself.c
@@ -214,7 +214,7 @@ int optval = 1;
static void server(int sd)
{
- gnutls_packet_st packet;
+ gnutls_packet_t packet;
/* this must be called once in the program
*/
@@ -269,6 +269,7 @@ static void server(int sd)
ret = gnutls_record_recv_packet(session, &packet);
if (ret == 0) {
+ gnutls_packet_deinit(packet);
if (debug)
success
("server: Peer has closed the GnuTLS connection\n");
@@ -277,12 +278,15 @@ static void server(int sd)
fail("server: Received corrupted data(%d). Closing...\n", ret);
break;
} else if (ret > 0) {
+ gnutls_datum_t pdata;
+
+ gnutls_packet_get(packet, &pdata, NULL);
/* echo data back to the client
*/
- gnutls_record_send(session, packet.data.data,
- packet.data.size);
+ gnutls_record_send(session, pdata.data,
+ pdata.size);
+ gnutls_packet_deinit(packet);
}
- gnutls_packet_deinit(&packet);
}
/* do not wait for the peer to close the connection.
*/