4822l7

Listing 7. Calling SSL_shutdown

51      r=SSL_shutdown(ssl);
52      if(!r){
53        /* If we called SSL_shutdown() first then
54           we always get return value of '0'. In
55           this case, try again, but first send a
56           TCP FIN to trigger the other side's
57           close_notify*/
58        shutdown(s,1);
59        r=SSL_shutdown(ssl);
60      }
61
62      switch(r){
63        case 1:
64          break; /* Success */
65        case 0:
66        case -1:
67        default:
68          berr_exit("Shutdown failed");
69      }