src/mrt.c
// mrt_disconnect: close the connection, 
// return 0 on success
// if the connection is already closed 0 would be returned
close the connection,
return 0 on success
if the connection is already closed 0 would be returned
close the connection return 0 on success if the connection is already closed 0 would be returned
int mrt_disconnect(mrt_connection * conn) {
  int timeout = 0;
  if (conn->active) {
    timer_set(&t);
    while (!timeout) {
      send_ctrl_pkt(conn->fd, &conn->addr, FLAG_FIN, 0, 0);
      if (conn->initialized) {
        conn_close(conn);
        break;
      }
      sleep(1);  
      if (timer_diff(&t) >= FIN_TIMEOUT) timeout++;
    }
    if (timeout) return 1;
  }
  return 0;
}
int mrt_disconnect ( mrt_connection * conn ) { int timeout = 0 ; if ( conn -> active ) { timer_set ( & t ) ; while ( ! timeout ) { send_ctrl_pkt ( conn -> fd , & conn -> addr , FLAG_FIN , 0 , 0 ) ; if ( conn -> initialized ) { conn_close ( conn ) ; break ; } sleep ( 1 ) ; if ( timer_diff ( & t ) >= FIN_TIMEOUT ) timeout ++ ; } if ( timeout ) return 1 ; } return 0 ; }
mrt_disconnect: close the connection,
return 0 on success
if the connection is already closed 0 would be returned
mrt_disconnect : close the connection return 0 on success if the connection is already closed 0 would be returned
// this means a FIN ACK was received