1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-21 00:25:37 +00:00
Commit Graph

184 Commits

Author SHA1 Message Date
Witold Filipczyk
06790918b0 [test] Fix ecmascript tests 2024-06-02 10:13:35 +02:00
Witold Filipczyk
ee43345e4a Revert "[curl] include sys/cdefs.h for __STRING" . Refs #306
This reverts commit 3923ae6d64.
2024-05-27 20:25:23 +02:00
Witold Filipczyk
5c92b4ee96 [libdom] Free keyboard and dom related strings 2024-05-12 18:52:27 +02:00
Witold Filipczyk
10555292b4 [interlink] trigger was unitialized 2024-05-05 20:46:48 +02:00
Witold Filipczyk
0f1e056875 [options] Minor optimisation. Store value of "test" option in variable 2024-04-23 16:07:35 +02:00
Witold Filipczyk
ebe3672e10 [select] unused function 2024-04-18 08:57:52 +02:00
Scott Mcdermott
3d1f020a3b [interlink] speed up first elinks, and use pipe trigger for fork_on_start
When the first elinks session starts (whether fork_on_start or not), it
tries to connect on AF_UNIX socket, to see if an existing master is
present.  The current code implements a retry loop with linear-increase
retry backoff, 50ms *= attempts, with 3 attempts, total delay 300ms,
before concluding master is not present.

After forking for fork_on_start, we do have to wait for the new master
to finish setup, so we can connect to it.  This is the case where retry
loop might be useful.  However in fork_on_start=0 case, there should be
no reason to ever wait: if we get ECONNREFUSED or ENOENT, the master
simply is not there, we can go on about our business as the master.

With fork_on_start=1 however, we will race with the child (that will
become the new master), which has to complete its socket/bind/listen
sequence.  Therefore we typically have to wait another 50ms (first
attempt delay), for a total of 350ms delay.

In both cases, there does not seem to be a purpose to the initial
connection attempt retry.  Conclusion after connect() failure should be
authoritative: there is no master.  We do not race with anyone.

If we have done fork_on_start and have to wait, we can instead open a
pipe before forking, and wait for the "new" master (its child) to send
us a byte over the pipe.  Thus, we do not need to poll, but can simply
block until we get the trigger, to indicate that AF_UNIX socket setup
has completed.

This speeds up the first start of elinks by 300ms for fork_on_start=0,
and between 300-350ms for fork_on_start=1 (or possibly more, if the
machine is loaded and child did not finish AF_UNIX setup in first 50ms).
2024-04-12 22:51:01 -07:00
Scott Mcdermott
b482b9e069 [interlink] do not nest retries for connect_to_af_unix(), it has already
Not sure why a retry loop using MAX_BIND_TRIES / BIND_TRIES_DELAY
surrounds connect_to_af_unix(), since bind() is done elsewhere in the
code, and connect_to_af_unix() already has its own retry loop inside the
function, with its own set of defines for retries, i.e. MAX_CONNECT_TRIES
/ CONNECT_TRIES_DELAY, surrounding the connect().  No need to have two
levels of retry; if it's not successful within connect_to_af_unix() it
will never be.
2024-04-12 20:05:53 -07:00
Witold Filipczyk
7545b8093d [getpid] Removed check for HAVE_GETPID
It is assumed that every supported system has getpid().
2024-04-11 11:17:30 +02:00
Witold Filipczyk
1489e4002a [style] shorter 2024-04-11 08:07:48 +02:00
Scott Mcdermott
b2556aa953 [fg] track master proc for suspend via pids, not term fds, for fork_on_start
When ui.sessions.fork_on_start, we fork a process that has a different
fdout than get_output_handle() (which has hardcoded fdout of 1), so it
will never be considered term->master, yet this is the process we want
to wake up in SIGTSTP handler.

Since we cannot rely on term->master to determine if we are the master
process, we instead move master_pid to be set explicitly at the places
where we have information about whether our process is a master or a
slave: first on start, then once the interlink determination has been
made.

master_pid has to be set in both parent and child, because both will get
suspended and need to know which one needs to resume in background with
SIGCONT (the master).  We can't inherit from the parent because it's
unknown at the time of fork.

Previously, master_pid worked correctly with fork_on_start=0,
-no-connect or -dump, but not with fork_on_start=1.

See #287 for background.
2024-04-10 15:14:23 -07:00
Witold Filipczyk
f2690c3e21 [loop] check_bottom_halves after starting libevent and curl
dump with curl enabled did not work
2024-03-18 18:19:12 +01:00
Witold Filipczyk
e47a482590 [signals] Removed code related to SIGALRM
links does not have such code.
2024-03-17 17:05:22 +01:00
Witold Filipczyk
6684f4bdef [select] Always compile-in select's version of curl functions
For -no-libevent 1
2024-03-17 17:00:13 +01:00
Witold Filipczyk
5410019b88 [select] Add suffix _select for curl's select related functions 2024-03-17 16:54:54 +01:00
Witold Filipczyk
b53bcce570 [libevent] copied related to signals code from links2
I don't know how it works, but CTRL-Z suspends without additional
keystrokes when libevent is enabled.
2024-03-08 21:14:17 +01:00
Witold Filipczyk
ce13ef6f97 [event] Do not mix libev headers with libevent 2024-03-08 13:33:58 +01:00
Witold Filipczyk
8167173954 Revert "[libevent] These lines seem not needed"
This reverts commit 419ead8604.
2024-03-07 19:22:52 +01:00
Witold Filipczyk
419ead8604 [libevent] These lines seem not needed 2024-03-07 19:15:51 +01:00
Witold Filipczyk
204234b921 [memcount] libevent malloc, realloc, free replacement functions 2023-12-26 19:09:32 +01:00
Witold Filipczyk
b1bf9e8dba [libevent] Add SOCK_SHIFT for curl and libevent 2023-12-26 17:04:24 +01:00
Witold Filipczyk
1f4ca1445d [libevent] include event2/event.h instead of event.h 2023-12-26 15:53:22 +01:00
Witold Filipczyk
5211b2d8a1 [curl] fifo_event was unused 2023-12-26 14:57:25 +01:00
Witold Filipczyk
8d0054041b [select] Another try
Set fields of timeout manually.
2023-12-20 20:31:13 +01:00
Witold Filipczyk
f91d214820 [select] This code is problematic.
EINVAL on OpenBSD/i386.
2023-12-20 18:06:20 +01:00
Witold Filipczyk
4ecb3fa8bb [main] timer.cpp -> timer.c 2023-11-27 15:08:20 +01:00
Witold Filipczyk
f70c1dc51b [main] module.cpp -> module.c 2023-11-25 14:30:05 +01:00
Witold Filipczyk
8164715d0f [select] SOCK_SHIFT for curl under Windows 2023-11-06 19:04:14 +01:00
Witold Filipczyk
6629f34466 [memcount] CONFIG_DEBUG inside memcount.h 2023-10-25 17:17:08 +02:00
Witold Filipczyk
1145193290 [curl] Added info about allocations in CONFIG_DEBUG 2023-10-24 17:39:26 +02:00
Witold Filipczyk
bd8b3f590c [view] Added option "ui.sessions.postpone_unlink" . Refs #257
This option let clean files after exit of elinks, not immediately.
2023-08-10 12:22:11 +02:00
Witold Filipczyk
2ab64d4a12 [redraw] Terminals are redrawn similar to links, but for downloads install timer. Refs #258
When download dialog is shown, redraw_all_terminals is limited to 20 fps.
At least in theory.
2023-08-08 13:12:15 +02:00
Witold Filipczyk
3923ae6d64 [curl] include sys/cdefs.h for __STRING 2023-07-25 16:14:14 +02:00
Witold Filipczyk
c09b5da405 [curl] free f when non NULL 2023-07-24 16:57:52 +02:00
Witold Filipczyk
a142489a63 [curl] multisocket action also without libevent or libev 2023-07-24 16:52:01 +02:00
Witold Filipczyk
868234cb13 [curl] Added libev code based on curl's evhiperfifo.c 2023-07-09 15:52:16 +02:00
Witold Filipczyk
1a5f77f1f4 [curl] Compilation fixes 2023-07-08 09:30:55 +02:00
Azamat H. Hackimov
393bf23a26 Fix compilation with Perl 5.38
Perl now includes own `struct object` which clashes with elinks
implementation. Renamed `struct object` to `struct elinks_object` to
avoid it.

Bug: https://bugs.gentoo.org/909042
2023-07-03 14:12:22 +03:00
Witold Filipczyk
759897306d [select] Code depends on libevent and libcurl 2023-06-28 12:27:17 +02:00
Witold Filipczyk
54416c0fa5 [select] Removed unused code 2023-06-22 20:12:56 +02:00
Witold Filipczyk
651e4e72e8 [config] curl's ftp related code requires libevent. Refs #240
It does not compile with libev.
2023-06-22 20:07:08 +02:00
Witold Filipczyk
7a91db2f13 [select] Compilation fix 2023-06-20 13:48:27 +02:00
Witold Filipczyk
853e8c544e [curl] Store estimated length for ftpes and sftp. 2023-06-20 08:51:34 +02:00
Witold Filipczyk
a67188413c [lists] LIST_HEAD -> LIST_HEAD_EL to not clash with libevent's LIST_HEAD. Also added curl implementation of ftpes and sftp
Implementation of ftpes and sftp is based on curl's hiperfifo example. It requires libevent.
ftpes only encrypts control channel. There were problems when both control and data were encrypted. It stucked on SIZE.
Only successful connections work, errors are not handled properly.
2023-06-19 18:43:53 +02:00
Witold Filipczyk
0d5a600b33 [select] kill_timer 2023-01-20 11:25:52 +01:00
Witold Filipczyk
201e6c055a [select] Start redrawing terminal also without libevent. Refs #201 2022-12-26 19:02:36 +01:00
Witold Filipczyk
7ea7cacade [.config] Read/write configuration from ~/.config/elinks . Refs #199
Note, configs and other files from ~/.elinks/ are not moved
to ~/.config/elinks/ automatically. You must do it yourself.

ELINKS_CONFDIR and HOME_ETC also are no longer supported.
2022-12-26 17:48:55 +01:00
Witold Filipczyk
d08bd08171 [select] period_redraw_all_terminals also for non-libevent 2022-12-16 22:19:16 +01:00
Witold Filipczyk
37cc5f52eb [terminal] Periodically refresh screen
DISPLAY_TIME_REFRESH 50ms (No more than 20fps).
It is still using too much CPU for refreshing screen.
2022-12-11 16:22:41 +01:00
Witold Filipczyk
fb30cb3bf4 [ecmascript] clearTimeout without iteration over timeouts list 2022-09-07 21:28:31 +02:00