diff options
Diffstat (limited to 'doc/examples/ex-serv-srp.c')
-rw-r--r-- | doc/examples/ex-serv-srp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/examples/ex-serv-srp.c b/doc/examples/ex-serv-srp.c index bf92a56966..c3dcae8455 100644 --- a/doc/examples/ex-serv-srp.c +++ b/doc/examples/ex-serv-srp.c @@ -125,7 +125,6 @@ main (void) for (;;) { - memset (buffer, 0, MAX_BUF + 1); ret = gnutls_record_recv (session, buffer, MAX_BUF); if (ret == 0) @@ -133,6 +132,10 @@ main (void) printf ("\n- Peer has closed the GnuTLS connection\n"); break; } + else if (ret < 0 && gnutls_error_is_fatal (ret) == 0) + { + fprintf (stderr, "*** Warning: %s\n", gnutls_strerror (ret)); + } else if (ret < 0) { fprintf (stderr, "\n*** Received corrupted " @@ -143,7 +146,7 @@ main (void) { /* echo data back to the client */ - gnutls_record_send (session, buffer, strlen (buffer)); + gnutls_record_send (session, buffer, ret); } } printf ("\n"); |