mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Kratz <eisw...@googlemail.com>
Subject [vysper] sending unavailable on lost connection
Date Thu, 04 Mar 2010 13:12:21 GMT
As promised I started to do some investigations on this.
I don't know if I get things right by today, and I don't have a
running envoriment at hand ( will have to wait for the weekend= but I
kindly ask if I'm going in the right direction.

I guess I try the following in AbstactSessionContext

public void endSession() {
        StanzaWriter stanzaWriter = getResponseWriter();
        stanzaWriter.close();
        sessionStateHolder.setState(SessionState.CLOSED); // no more
traffic going through
        getServerRuntimeContext().getResourceRegistry().unbindSession(this);

        // send unavailable to all contacts and other resources

       PresenceStanza lastPresence =
serverRuntimeContext.getPresenceCache().get(initiatingEntity);
        List<Attribute> presenceReplacements = new ArrayList<Attribute>(1);
        presenceReplacements.add(new Attribute("type",
PresenceStanzaType.UNAVAILABLE.name()));
        Stanza unavailableStanza =
StanzaBuilder.createClone(lastPresence, true,
presenceReplacements).build();
        serverRuntimeContext.getStanzaProcessor().processStanza(serverRuntimeContext,
this, unavailableStanza, sessionStateHolder);

        // remove latest availability from LatestPresenceCache
        serverRuntimeContext.getPresenceCache().remove(initiatingEntity);

        // TODO close underlying transport (TCP socket)
        // ?? how to get hold of the socket ?
}

Are these the right ideas to do that ?

Regards Thomas

-- 
http://www.buchmanager.com
http://thomaskratz.blogspot.com

Mime
View raw message