Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
(Remove tcpenabled from config.def.h as it can easily be flipped
at runtime via the cmdline switch).
|
|
|
|
|
|
|
|
friendcreate() populates the fs, frienddestroy() removes the
friend related files from the fs.
removefriend() only acts on the data from the friend's remove
fifo. The "callback" in this case is responsible for reading the
fifo like in all other cases (sendfriendtext() etc.).
No weird dance with special function arguments to flag "official"
removal. All friend related "callbacks" just need to operate on
a struct friend *.
|
|
|
|
|
|
|
|
|
|
This breaks if time travel becomes a possibility.
|
|
|
|
|
|
|
|
|
|
Use fd's instead of fp's and simplify the case-handling for encryption.
|
|
After the previous simplification of return-values of fiforead()
(exit if there's a more serious issue), fifoflush() can easily
be replaced with a oneliner calling fiforead until it returns 0.
In case 0 is returned, the underlying fifo will have already been
reopened.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Default to IPv4.
|
|
|
|
|
|
|
|
This also sends a broadcast to all friends you went offline,
leading to an immediate event-feedback.
|
|
Remove ugly casts.
|
|
dirfd should be the first arg to be consistent with other
functions.
|
|
Put the error-strings in one single data-structure and flush the err-file
every time before a new incoming request, so it's empty when the request
succeeds.
|
|
fiforead() automatically reopens a file-descriptor in case
it returns EOF (return 0).
It returns -1 on error.
|
|
|
|
Also flush the fifo for stalled transfers
|
|
The OUT_F-type was not clear. Make it easier to see the out-file
has no state (=NONE) and is defined for each slot individually.
Moreover, in the initial creation, the err-file fell through
just because STATIC = 0 and .outfile wasn't defined for it.
It was only coincidence this worked and now we have a much
more bulletproof implementation.
|
|
|
|
The doc lies, if the receiver resumes a transfer you get
a control packet with send_receive == 1 and control_type == TOX_FILECONTROL_ACCEPT.
We keep state locally and move from PAUSED to INPROGRESS when the
above happens.
|
|
Doesn't quite work yet though.
|
|
|
|
Just re-open them to clear EOF.
|
|
O_RDWR is a dirty hack to get around the issue of infinite
EOFs while reading an in-FIFO.
Instead, stop breaking POSIX and set the FIFOs to O_RDONLY.
In case a read returns EOF (r == 0), we reopen the fd.
Same will be applied to the friend-fifos (especially file_in),
helping us get rid of strange timeouts and heuristics and
rather solve the problem the POSIX-way.
The only downside to this is that we are blind for writes
to the in-FIFOs between catching read == 0 and close(), but this is
not an issue.
To make reopening as easy as possible, I added a dirfd
to all slots.
While at it, I changed the initial setup and removed the chdir()
in favor of the POSIX-2008-compliant *at-functions.
This lets us do stuff without having to use snprintf to build
paths and is more bulletproof even in case the directory is
renamed.
|