/* * tnt_connect() * * connect to server; * reconnect to server; * * s - network stream pointer * * returns 0 on success, or -1 on error. */ int tnt_connect(struct tnt_stream *s) { struct tnt_stream_net *sn = TNT_SNET_CAST(s); if (sn->connected) tnt_close(s); sn->error = tnt_io_connect(sn, sn->opt.hostname, sn->opt.port); if (sn->error != TNT_EOK) return -1; return 0; }
/* * tnt_rpl_close() * * close a connection; * * s - replication stream pointer * * returns 0 on success, or -1 on error. */ void tnt_rpl_close(struct tnt_stream *s) { struct tnt_stream_rpl *sr = TNT_RPL_CAST(s); if (sr->net) tnt_close(s); }