Logo Search packages:      
Sourcecode: jabber-jit version File versions  Download package

void it_session_exit ( void *  arg  ) 

Shutdown session, free resources etc

Definition at line 285 of file session.c.

References session_st::client, session_st::contacts, elemqueue::elem, session_st::id, it_contact_free(), it_session_free(), session_st::p, session_st::p_db, session_st::pend_search, session_st::q, session_st::queue, session_st::queue_last, session_st::s_mio, session_st::ti, and session_st::vcard_get.

Referenced by it_session_end(), and it_session_error().

{
    session s = (session) arg;
    iti ti = s->ti;
    queue_elem queue;

    log_debug(ZONE,"Session[%s], exiting",jid_full(s->id));

    if (s->client != NULL) {
      /* free C++ if error from C++ */
      EndClient(s);
    }

      s->client = NULL;

    /* free mio */
    if (s->s_mio) {
      mio_close(s->s_mio);
      s->s_mio = NULL;
    }

    while ((queue = QUEUE_GET(s->queue,s->queue_last)) != NULL)
    {
      xmlnode x = ((jpacket)(queue->elem))->x;
      if (((jpacket)(queue->elem))->type == JPACKET_PRESENCE) {
        xmlnode_free(x);
      }
      else {
        jutil_error(x,TERROR_NOTFOUND);
        it_deliver(ti,x);
      }
    }
    
    s->queue = NULL;
    s->queue_last = NULL;

    ppdb_free(s->p_db);

    if (s->contacts)
      it_contact_free(s);

    if (s->pend_search) {
      pool_free(s->pend_search->p);
      s->pend_search = NULL;
    }

    if (s->vcard_get) {
      pool_free(s->vcard_get->jp->p);
      s->vcard_get = NULL;
    }
    
    mtq_send(s->q,s->p,it_session_free,(void *) s);
}


Generated by  Doxygen 1.6.0   Back to index