What is Megaphone?

What is Megaphone?
The Megaphone project is about enhancing open source chat software. Specifically, the goal is to allow ejabberd to support 1,000,000 simultaneous users. See The Plan page for more details on how I plan to solve this problem. See the About this Blog page for more details on why I created this blog.

Thursday, February 16, 2012

Testing megaphone_sender: Go Me!

Previously...
  • I completed testing for receiving data from the BOSH client.
  • I puzzled through some ejabberd issues with send.
  • I started testing the send functionality.

I managed to get the send functionality to the point where it seems to work.  In situations like this, I find it better to stop when things appear to be working rather than inquiring too closely as to whether they are actually working - at least this way I have the delusion of progress.

The problem with einval was actually a test to allow readers to learn more about erlang.  That's my story and I'm sticking to it!  This was caused by the dreaded active mode/passive mode aspect of gen_tcp and not at all because I made the same mistake twice.

Sigh.

Elsewhere in the news, have I mentioned how much I admire Denmark?  This is not at all because a recent surge in hits for this site appear to have come from there.  Nope.  Not at all.

After resolving the issue with active/passive TCP sockets, I realized that I had not actually written the code to send packets.  As it turned out this was not a huge problem because the code to send a packet consisted of the following:

send(ConnectionID, Data) ->
    megaphone ! { send_data, ConnectionID, Data }.

I'm not exactly thrilled by the fact that I have three processes to do this one job.  And that one of those processes sole duty is to pass data on to the other two processes.  Of course I can always rewrite it and then claim that was my plan all along.  I can even point to these posts as evidence...hmmm.....

At this point I suppose the next step is to try and wire the thing up to ejabberd and see what breaks.  I'm sure the fact that I found all these annoying bugs and problems at this stage instead of after I have it connected to ejabberd will save me a lot of time.  Of course the only way to figure out how much time I saved is to put all the bugs back in and then...oh never mind.

Next time: connecting to ejabberd.

No comments:

Post a Comment