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.

Monday, February 13, 2012

Receive: Excelsior!


Previously...
  • I resolved some problems with lists and test data.
  • I resolved some problems with dictionaries.
  • I encountered some problems with states.

While I have a nagging belief that saying that something is working will immediately cause the code gremlins to break everything, I finally managed to get the receive portion of the Megaphone tests to at least look like they are working!

The output of the test_receive_read looks like this:


1> megaphone:test_receive_read().
will try to send packet to port 4567
megaphone is now listening on port 4567
megaphone now has a connection on port 4567, starting...
megaphone is now running
Sent test packet to 4567
{ok,{http_request,'POST',{abs_path,"/"},{1,1}}}
{ok,{http_header,24,'User-Agent',undefined,
                 "curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15"}}
{ok,{http_header,14,'Host',undefined,"localhost:4567"}}
{ok,{http_header,8,'Accept',undefined,"*/*"}}
ok
2> 

A bunch of gibberish I know, but the basics are that the first call to recv results in the line 

{ok,{http_request,'POST',{abs_path,"/"},{1,1}}}


Which denotes that the connection received an HTTP POST.  The next three lines contain some of the header lines from the POST.


{ok,{http_header,24,'User-Agent',undefined,
                 "curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15"}}
{ok,{http_header,14,'Host',undefined,"localhost:4567"}}
{ok,{http_header,8,'Accept',undefined,"*/*"}}


A small victory I know, but I may as well savor it, since so much of what I do seems to be fixing problems in my stuff.  It's nice when something works for a change.

Next time: start on send tests.

No comments:

Post a Comment