summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-03-26link: Don't register catchall pattern if !l->activeHEADmasterYorhel1-1/+2
2012-03-26Fixed incorrect va_arg() argument in tn_el_newv()Yorhel1-1/+1
2012-03-26Added const keyword to some string argumentsYorhel2-12/+12
2012-03-26Turned tanja_pthread.c into a header fileYorhel4-57/+52
It's pretty small anyway, might as well just inline everything.
2012-03-25Lowered minimum map size from 32 to 16 bucketsYorhel2-2/+2
I'd expect small maps (<10 items) to be quite common, and 32 buckets is a waste of memory in that case. It's not like growing the map takes that much time at the small sizes anyway. (This not-surprisingly changed the order of the object elements in a json test)
2012-03-24Fix over-allocation bug in hash tableYorhel1-1/+1
Performance-wise, this over-allocation may not be too bad, it avoids some collisions. :-) (Talking about collisions, the hash function provided by khash.h performs quite poorly on the many-numbers test in tuple.c, I hope it does better for other kinds of data :-/)
2012-03-25test/tuple: Make sure to pass integers as uint64_t to va-arg functionYorhel2-5/+5
Things really go wrong otherwise... perhaps I should add a feature to have it accept normal "int" as well, because I can imagine that this casting requirement is going to be a source of bugs.
2012-03-25Pass va_list around as a pointer rather than a valueYorhel1-10/+10
Apparently, the only thing you're allowed to do with a va_list variable is calling va_end() after passing it to a function. Passing the va_list as a pointer does what I want. (This resulted in problems on my 32bit Arch installation, it worked fine on 64bit)
2012-03-24test/tuple.c: Added vim modeline + reformatYorhel1-113/+114
Forgetting the vim modeline will make me write messy space/tab-mixing code. Very bad...
2012-03-24Use a hash table to store maps in tuplesYorhel4-57/+153
This is a small hash table I wrote myself, in order to re-use the fields in the tn_el structure and keep the structs simple. I have no idea how well it performs, but as long as I didn't screw up it'll do the trick just fine.
2012-03-24Added tn_map_get() functionYorhel2-0/+16
2012-03-24Increase JSON number format precisionYorhel2-11/+11
...to 15 significant digits. This does not cover the full range of a double (16 digits would be necessary for that), because using that many digits will also expose that some numbers can't be stored exactly. E.g. 1.2 will become 1.19999999999999996, etc. Which isn't very nice.
2012-03-23tn_json_parse(): Limit max. recursion depthYorhel2-12/+21
2012-03-23test/pthread: Fixed wrong assertions about reply/alpha receive orderYorhel1-2/+2
They happen simultaneusly, so their order not fixed.
2012-03-23Added a few simple tuple management tests + two minor fixesYorhel5-9/+129
2012-03-23Added tn_el_str()Yorhel2-0/+19
2012-03-23Use tn_et_intval() in tn_tuple_match()Yorhel1-26/+1
This is in line with my recent edits to the spec, and more intuitive since matching behaviour is consistent with the tn_et_int() fetch functions.
2012-03-23Added functions to read out integer / number values from elementsYorhel2-0/+66
In a dynamically typed fashion. Still totally untested.
2012-03-23Added tn_el_new() and tn_el_copy() functionsYorhel2-25/+60
2012-03-23Function name consistency: s/create/new/Yorhel5-25/+25
2012-03-23Making things a bit shorter: s/element/el/gYorhel2-74/+74
2012-03-21link: Reset l->tbuf when it is not being used anymoreYorhel1-0/+2
This fixes a double free error when the link is being freed. (As l->wbuf->dat == l->tbuf->dat in certain situations)
2012-03-21link: Forward remote returnpaths to the local codeYorhel2-9/+82
Functionality-wise, this finalizes the link code. There's still a lot of testing to do, and no doubt can there be a few more useful features.
2012-03-21link: Forward local return paths to the networkYorhel2-5/+57
Opposite direction isn't done yet.
2012-03-20link: Fix refcounting of the returnpath for link with self-matching tupleYorhel1-6/+7
Not that return-paths are currently handled at all by links, but this would have been a potential (and hard to find) bug.
2012-03-20link: Send tuples from the local node to the networkYorhel1-9/+30
Doesn't do any return-path stuff yet.
2012-03-20link: Added ready callbackYorhel3-1/+30
2012-03-20link: Changed locking stuff a bit + implemented remote pattern syncYorhel1-46/+131
For pattern registration related stuff, the caller is now responsible for locking the node mutex. This is to allow the caller to perform some more actions in a single critical section, which the link requires. I also use l->active now to indicate that state data should not be modified/relied upon, to allow _set_error() to immediately unregister stuff with the node without requiring a lock.
2012-03-20link: Don't always hold the lock in the read handlersYorhel1-35/+31
This is true to the "Only hold a mutex for the shortest time possible" philosophy, and fixes a possible deadlock with regard to ordering of the node and link mutexes. This also means that the read buffer and node-notification-list are only freed/updated when the last reference to the link object has dropped, since that is the only time when it is guaranteed that the link lock is not held.
2012-03-20link: Implemented syncing of our patterns to the connected partyYorhel1-22/+104
While this seems to work, I suspect that there is a possible deadlock in the current code. I'll have to further investigate that and try to come up with a fix... Also changed the way tn_link_write() works, because it's more efficient to write to the buffer directly instead of first constructing the message in a temporary buffer and then potentially copying it to another one.
2012-03-20link: Added message handling framework + bugfix in setting NULL errorYorhel1-4/+140
2012-03-19Makefile clean fix + lock in tn_link_start() + assert in _set_sync()Yorhel2-2/+6
2012-03-19tanja.h: Added include-once macro checkYorhel1-0/+5
2012-03-19Set 'sync' property of link as function rather than create argumentYorhel4-7/+13
This keeps the argument list for creating a link small, since the create function is supposed to be wrapped by a context.
2012-03-19tanja_pthread: Close the file descriptor when the link has been closedYorhel1-0/+1
Otherwise the other side of the connection will never know what happened.
2012-03-19Rewrote link-context interaction frameworkYorhel4-138/+232
- Like sessions, links are refcounted - Like sessions, closing a link is indicated as return value to tn_link_dispatch() - Writing the buffer to the network is context-initiated (using tn_link_startwrite()) rather than callback-based - Most state is protected by the mutex This simplifies some things a little, and allows for properly handling _close() outside of the link context.
2012-03-18tanja_pthread.c: Ensure that SIGUSR2 will be unblocked in syscallsYorhel1-0/+2
When creating a session from a session thread, the signal mask will be inherited and thus SIGUSR2 will already be masked. This isn't really a problem, but the signal really shouldn't be in the sigset argument that is given to the system calls.
2012-03-18Indicate session close in dispatch call instead of close callbackYorhel3-57/+39
And make tn_session_(un)ref() public. This simplifies the implementation of the context a bit, and makes it easier to allow a tn_session_close() from any context. I actually thought this up for use with tn_link, but realized it would simplify sessions as well.
2012-03-18Fix infinite loop when link handshake has an unknown parameterYorhel1-0/+6
2012-03-18Added simple (manual) link tester + fix race in tanja_pthread.cYorhel4-13/+139
These should definitely help with further implementing and testing the link functionality.
2012-03-16Expanded pthread test + fix mem leak + allow tn_reply(NULL, ..)Yorhel2-17/+80
All I found with all these extra test was a lousy memory leak. :-(
2012-03-16Automated minimal pthread test + fix pthread sync. and tuple matching bugsYorhel4-35/+59
2012-03-15Added copyright to source files + README typo fixYorhel6-1/+121
2012-03-15Moved tests and Makefile to subdir + split json tests in separate fileYorhel5-61/+85
2012-03-15Added README, COPYING and .gitignore filesYorhel3-0/+49
2012-03-15Use (more) automated testing + fixed some bugs in the JSON parserYorhel2-63/+118
2012-03-14Added JSON parser + fixed some bugs in formatter + tuple handlingYorhel4-19/+444
2012-03-02Use lbuf abstraction for JSON-formatting tuplesYorhel3-103/+97
Makes it easier/more efficient to write tuples directly to the link buffer.
2012-03-02Improved error handling for link objectsYorhel4-24/+82
2012-03-02Added pthread context for links + fixed a few bugsYorhel4-38/+198
It can do a successful handshake now, yay!