static void pingpong_on_client_close (evcom_stream *stream) { assert(EVCOM_CLOSED == evcom_stream_state(stream)); assert(stream); printf("client connection closed\n"); evcom_server_close(&server); evcom_stream_detach(stream); }
static void common_on_peer_close (evcom_stream *stream) { assert(EVCOM_CLOSED == evcom_stream_state(stream)); assert(stream->errorno == 0); printf("server connection closed\n"); #if EVCOM_HAVE_GNUTLS assert(stream->gnutls_errorno == 0); if (use_tls) gnutls_deinit(stream->session); #endif evcom_stream_detach(stream); free(stream); }
void evcom_stream_force_close (evcom_stream *stream) { if (stream->recvfd >= 0) { close(stream->recvfd); /* XXX What to do on EINTR? */ stream__set_recv_closed(stream); } if (!DUPLEX(stream) && stream->sendfd >= 0) { close(stream->sendfd); } stream__set_send_closed(stream); evcom_stream_detach(stream); }
void b_close (evcom_stream *stream) { evcom_stream_detach(stream); assert(stream == &b); b_got_close = 1; assert(stream->errorno == 0); #if EVCOM_HAVE_GNUTLS if (stream->gnutls_errorno) { fprintf(stderr, "\nGNUTLS ERROR: %s\n", gnutls_strerror(stream->gnutls_errorno)); } assert(stream->gnutls_errorno == 0); if (use_tls) gnutls_deinit(stream->session); #endif }
static void connint_on_client_close (evcom_stream *stream) { evcom_stream_close(stream); // already closed, but it shouldn't crash if we try to do it again printf("client connection closed\n"); MARK_PROGRESS(".", nconnections, NCONN); if(++nconnections == NCONN) { evcom_server_close(&server); printf("closing server\n"); } evcom_stream_detach(stream); }