Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
It's pretty small anyway, might as well just inline everything.
|
|
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)
|
|
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 :-/)
|
|
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.
|
|
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)
|
|
Forgetting the vim modeline will make me write messy space/tab-mixing
code. Very bad...
|
|
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.
|
|
|
|
...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.
|
|
|
|
They happen simultaneusly, so their order not fixed.
|
|
|
|
|
|
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.
|
|
In a dynamically typed fashion.
Still totally untested.
|
|
|
|
|
|
|
|
This fixes a double free error when the link is being freed. (As
l->wbuf->dat == l->tbuf->dat in certain situations)
|
|
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.
|
|
Opposite direction isn't done yet.
|
|
Not that return-paths are currently handled at all by links, but this
would have been a potential (and hard to find) bug.
|
|
Doesn't do any return-path stuff yet.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
This keeps the argument list for creating a link small, since the create
function is supposed to be wrapped by a context.
|
|
Otherwise the other side of the connection will never know what
happened.
|
|
- 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.
|
|
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.
|
|
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.
|
|
|
|
These should definitely help with further implementing and testing the
link functionality.
|
|
All I found with all these extra test was a lousy memory leak. :-(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Makes it easier/more efficient to write tuples directly to the link buffer.
|
|
|
|
It can do a successful handshake now, yay!
|