Evan Martin (evan) wrote in logjam,
Evan Martin

new network code

New network code is now in CVS. LogJam now supports native networking calls on Windows, and the code for Unix is a bunch cleaner. Here are my notes on it (primarily for someone like gaal, who might have to use it someday!) and for whoever else cares.

The old network code used to be a big jumble, in part because it was the combination of a few different things in one interdependent pile of functions:
  • the code to use curl
  • the code to handle communication through the fork
  • the GUI for network progress
  • the high-level network-request functions

Redesigning things to work on Windows simultaneously required me to reevaluate all that and I think the result is cleaner. It now looks like this:
  • network-platform.c (currently) provides two low-level HTTP interfaces which report progress through callbacks.
    1. A blocking interface. This actually does the calls into the underlying library.
    2. A "mainloop" interface. (This one is two functions-- one to start, and another to cancel one in progress.) The mainloop interface starts the blocking request in another process/thread and starts a GTK/glib mainloop, which means that if you (for example) had a network status window up when you called the function, it would continue updating.
  • network.c provides the higher-level interface used through LogJam, in which you give it a NetRequest hash and it returns a NetResult hash. It handles all the GUI and serializing/deserializing these hashes for use in HTTP requests by the lower layer.

Why is this important? Well, aside from things working on Windows, now, there are a bunch of places we've needed finer control over the network requests. For example, we're now able to do things like pull a person's userpics (which will use the HTTP functions with a different GUI and not the higher-level LiveJournal-request-oriented functions) and download a person's journal (which will be a series of LiveJournal-requests that need a different GUI as well).

In case you haven't guessed, I got mono and I've been stuck inside for a week. :)

  • Ubuntu 16.04

    LogJam for Xenial please?

  • Ubuntu 15.10

    Cannot install logjam package after upgrading my 64-bit system to Ubuntu 15.10. Any ideas?

  • Help creating a Deadjournal server entry

    Howdy. I have two questions, and the second question probably relates to the first. I don't know what port setting I should input when creating the…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment