[Gajim-devel] BOSH implementation and xmpppy testing

Yann Leboulanger asterix at lagaule.org
Sun Jun 8 17:15:22 CEST 2008

Tomas Karasek wrote:
> Hi everyone,

Hi Tomas,

> I see two ways of implementing the BOSHTransport:
> * Use NonBlockingTcp as TCP connection - In this case, some changes have
>   to be done in NonBlockingTcp:
>   - sending of </stream> on TCP disconnecting would have to move to
>     Client or to Connection - stream is closed differently in BOSH
>   - loop of _do_connects over IP addresses from getaddrinfo() also to
>     Client - considering the nonpersisent HTTP - after TCP disconnect,
>     client should connect to CM where its session is already opened (to
>     the same IP), plus no need for DNS requests every time
>    - maybe some more things I don't see right now
>   There is advantage of reusing the HTTPProxy and SOCKS5Proxy classes
>   derived from NonBlockingTcp - same could be used for XMPP over proxy
>   as for BOSH over proxy.
> * Write BOSHTransport from scratch - In this case, I would write new
>   TCP/HTTP wrappers implementing the IdleObject interface. There could
>   probably be some code duplication between NonBlockingTcp and
>   BOSHTransport. Another proxy wrappers have to take place.
> I'm up for the first option.

I also think first option is better
What about doing a NonBlockingCommonTcp that will contain common code
for both NonBlockingTcp and NonBlockinhBoshTcp?

> I'm just interested in your
> opinions about the current state of Gajim xmpppy and improvement
> suggestions I could consider. I went through
> http://trac.gajim.org/query?status=new&status=assigned&status=reopened&group=component&component=xmpppy&order=priority 

Indeed that's all problems we have with xmpppy

> and I'll try to remove the unused code for starters.

Haa good start ! Maybe we can remove the non _nb.py files once usefull
code from there goes to _nb.py files.

> Another topic is xmpppy testing - If I was about to refactor
> NonBlockingTcp class, I would probably first write a unit test for
> NonBlockingClient to avoid unintentional screw up of something. I'm not
> very familiar with unit testing but I quickly read unittest python
> manual and it could be done like this: initialize IdleQueue and
> callbacks in setUp() method, and then calling functions for connecting,
> authentication, sending a message etc. interleaved with
> IdleQueue.process() calls.
> Is NonBlockingClient good place for Gajim unit testing?

I let bct reply here :)

More information about the Gajim-devel mailing list