Commit Graph

328 Commits

Author SHA1 Message Date
Steve Dee
607c83d683 Various fixes and cleanups 2014-03-14 11:02:45 -07:00
Steve Dee
ba71f7ca11 Trailing whitespace cleanup, C level 2014-03-14 10:50:12 -07:00
Steve Dee
0f64d9b859 Fix _http_bods_free 2014-03-13 11:29:14 -07:00
Steve Dee
2d1cab488c Fix leak in u2_raft_work 2014-03-13 11:26:27 -07:00
Steve Dee
079c4f7696 Remove useless assert... 2014-03-12 11:54:14 -07:00
Steve Dee
b71e6f161d Remove old fprintf 2014-03-12 11:52:11 -07:00
Steve Dee
27ec17b711 TODOs 2014-03-12 11:35:30 -07:00
Steve Dee
c56cfccc7d Bail instead of exit 2014-03-12 11:35:30 -07:00
Steve Dee
e787049b65 Clean up timer logic 2014-03-12 11:35:29 -07:00
Steve Dee
1627b6e78c More intelligently load from sist 2014-03-12 11:35:26 -07:00
~hatteb-mitlyd
cff116fa0c don't leak 2014-03-11 14:20:27 -07:00
~hatteb-mitlyd
6e00220193 avoid responding to a dead http req 2014-03-11 14:11:03 -07:00
Steve Dee
afa1c641e9 Start ent_w at 1
Also, increment our sequence numbers if we have to.
2014-03-11 07:46:32 -07:00
Steve Dee
399530d379 Use same election timeout always
In particular, we wait at least 150ms after starting up before declaring
an election, to give the old leader a chance to send us a heartbeat.
2014-03-10 16:25:48 -07:00
Steven Dee
6466a1760a Fix on linux, remove a debug printf 2014-03-10 23:18:58 +00:00
Steve Dee
f4f1c711d5 New event log format including term and type 2014-03-10 16:14:21 -07:00
Steve Dee
6a3a939c4a Fix for duplicate vote responses 2014-03-10 12:18:18 -07:00
Steve Dee
970c6d431f Fixes for dir syncing in raft leader mode 2014-03-10 12:10:17 -07:00
Steve Dee
ad70fa2380 Check for null vog_c 2014-03-10 11:52:49 -07:00
Steve Dee
a5b23546a6 Bump votes on restore 2014-03-07 19:25:03 -08:00
Steve Dee
139c46dd63 Fix revo logic 2014-03-07 19:16:08 -08:00
Steve Dee
be218d4f8a More aggressive reconnecting 2014-03-07 19:12:27 -08:00
Steve Dee
c5bb5bb5e7 Moronic key-value store
This is kind of dumb, but we need to persist stuff for Raft, and
we can't touch noun state from followers.
2014-03-07 19:12:27 -08:00
Steve Dee
8aa97708f4 Fix a stupid in c3_log_every 2014-03-07 19:12:21 -08:00
Steve Dee
1786c0a048 Cleanup 2014-03-07 16:47:30 -08:00
Steve Dee
7371ba09fc Fix a segfault on startup :( 2014-03-07 16:46:46 -08:00
Steve Dee
551f28b594 Log on bump to candidate 2014-03-07 16:26:15 -08:00
Steve Dee
f92eaf970c Clean up Raft options and init
I opted to keep u2_opts to just numbers, strings, and beans for now and
parse them to peer names in the Raft init code.
2014-03-07 16:19:38 -08:00
Steve Dee
e7f6270864 Rejigger boot sequence
The calls to u2_raft_work were effectless since the log hasn't been
initialized by that point.
2014-03-07 13:45:31 -08:00
Steve Dee
e43b99af67 Log killed connections 2014-03-07 13:24:33 -08:00
Steve Dee
3cda85ddc1 Longer heartbeat log interval 2014-03-07 12:26:34 -08:00
Steve Dee
71e67e7e9b Fix long line 2014-03-07 12:17:08 -08:00
Steven Dee
8ef45612dd Unsigned format specifiers 2014-03-07 20:01:09 +00:00
Steve Dee
3383de7938 Comments 2014-03-07 20:01:04 +00:00
Steve Dee
1e10cd5d95 Clean up connections
The code seems much less racy now.
2014-03-07 20:00:44 +00:00
Steven Dee
22ca1dfdf0 Rejigger connection killing 2014-03-07 20:00:44 +00:00
Steven Dee
53fafd25fd update -> note, and call it 2014-03-07 20:00:44 +00:00
Steven Dee
7c7c044525 Add ron_u->liv
This prevents us from double-killing connections in races, e.g. the
one between _raft_rest_name and _raft_connect_cb.
2014-03-07 20:00:44 +00:00
Steven Dee
60e63dd869 s/raft/sist/ 2014-03-06 10:53:32 -08:00
Steven Dee
e5a11b5aa0 Minor fixes and cleanup 2014-03-06 10:18:36 -08:00
Steve Dee
27e45b8c48 Fewer TODOs 2014-03-06 08:59:21 -08:00
Steve Dee
cc345da3e4 Clean up and dedup message writing 2014-03-06 08:59:21 -08:00
Steve Dee
9e2f12fb80 Leader election appears to work 2014-03-06 08:59:20 -08:00
Steve Dee
2e0f7df85c Duplex connections 2014-03-06 08:59:20 -08:00
Steve Dee
66fedab1fe Raft message sending working 2014-03-06 08:59:20 -08:00
Steve Dee
1ea754ef88 Some TODOs 2014-03-06 08:59:20 -08:00
Steve Dee
008558a1f7 WIP hand-rolled parsing, read side 2014-03-06 08:59:20 -08:00
Steve Dee
85c3cf4f5e Use uv_ip4_addr 2014-03-06 08:59:20 -08:00
Steve Dee
cc096a99af Comment log lines 2014-03-06 08:59:20 -08:00
Steve Dee
f17f0add72 More sanity checking and cleanup 2014-03-06 08:59:20 -08:00
Steve Dee
af91e4a2c1 WIP more work 2014-03-06 08:59:20 -08:00
Steve Dee
d045f31f23 Rejigger the event loop again 2014-03-06 08:59:20 -08:00
Steve Dee
3f7e6d5e94 More work 2014-03-06 08:59:20 -08:00
Steve Dee
abc5d4fb0d More work 2014-03-06 08:59:19 -08:00
Steve Dee
5507162089 Comments 2014-03-06 08:59:19 -08:00
Steve Dee
424af0354d WIP Raft network base 2014-03-06 08:59:19 -08:00
Gavin Whelan
c85fd1fe35 Fixed Linux specific bug causing lack of stack overflow traces. 2014-03-04 14:48:59 -08:00
C. Guy Yarvin
3b98f316a0 Various fixes and improvements. 2014-03-04 11:17:34 -08:00
C. Guy Yarvin
dd4a42b345 Some HTTP client fixes. 2014-03-03 11:51:35 -08:00
C. Guy Yarvin
3400b6bacb Working HTTP client. 2014-03-02 14:31:03 -08:00
C. Guy Yarvin
16dd948e7d Attempted fix to an intermittent sync event bug. 2014-02-27 10:33:20 -08:00
C. Guy Yarvin
a7055224fa Various HTTP client fixes. 2014-02-26 17:58:40 -08:00
C. Guy Yarvin
af81e7c7b4 Trivial test cahnge. 2014-02-26 16:42:43 -08:00
C. Guy Yarvin
54ed2bdcb0 More C files. 2014-02-26 16:40:53 -08:00
C. Guy Yarvin
cc255a4c49 New cttp file. 2014-02-26 16:39:48 -08:00
Steve Dee
edc28b9ba7 Get new event loop working with checkpoints
Modifying u2_reck is a bad idea in the face of checkpoints. Just stick
everything on roe. This actually cleans up the logic a bit -- we can
execute non-core-modifying actions immediately, rather than on the next
tick.
2014-02-25 12:18:18 -08:00
Steve Dee
d7e4c46150 Revert "Revert "Merge remote-tracking branch 'urbit/master' into master""
This reverts commit dc6f72fa0a8ff2097b1e9c900ebec444c0d4c24f.
2014-02-25 12:18:07 -08:00
Steve Dee
de5048e895 Revert "Merge remote-tracking branch 'urbit/master' into master"
This reverts commit d52d2835b96f89e7ebbe5392c99f1483d165ee0b, reversing
changes made to 58838ea246e52c064719edc56e29b6a1ba713fdf.

Conflicts:
	Makefile
2014-02-24 11:27:57 -08:00
Steve Dee
9b992ae438 Merge remote-tracking branch 'urbit/master' into master
Conflicts:
	v/loop.c
2014-02-24 10:45:10 -08:00
Steve Dee
d83f057881 bail instead of exit from boot
Fixes terminal state not being reset on boot error. We pre-initialize
pig to prevent warnings since gcc doesn't understand that u2_lo_bail
exits.
2014-02-24 10:40:52 -08:00
Steve Dee
284811c92b Assert single-instance mode on push 2014-02-24 10:31:38 -08:00
Steve Dee
6143fe46b2 Back out log format version bump 2014-02-24 10:29:08 -08:00
Steve Dee
242e888c2c Get entry number from raft data structure directly 2014-02-24 10:17:26 -08:00
Steve Dee
575f28cef0 Commit on next libuv cycle in single-instance mode 2014-02-19 13:57:17 -08:00
Steve Dee
2fc0ccf2d1 Fix event playback 2014-02-19 11:51:44 -08:00
Steve Dee
a957cd649e WIP cleanup and fixes 2014-02-18 16:48:46 -08:00
C. Guy Yarvin
4e42621b93 Add gc in restore. 2014-02-17 22:29:23 -08:00
Steve Dee
e0e37cc569 Splinter disk persistence and reck stuff back out 2014-02-17 18:21:24 -08:00
Steve Dee
704dfd6d85 Write term and log type, in preparation for raft 2014-02-17 17:56:42 -08:00
C. Guy Yarvin
6c22acbfa7 Some memory palliatives. 2014-02-14 17:35:22 -08:00
Steve Dee
6182bd7d14 New event loop working, super rough cut 2014-02-14 15:15:38 -08:00
Steve Dee
27b50018a4 More loop -> raft, add u2_raft_boot 2014-02-12 17:27:09 -08:00
Steve Dee
2d5f78e39a WIP Move lug_u to u2_raft 2014-02-12 11:50:24 -08:00
Steve Dee
5db81ccab7 Trivial fixups 2014-02-12 11:50:05 -08:00
Steven Dee
53735a8b33 Fixes to our hi/lojack logic
This doesn't actually fix the prompt-eating bug, but it sure looks like
it ought to, doesn't it?
2014-02-12 18:06:49 +00:00
Steve Dee
0ccaadd10b WIP raft single instance
Shove all our disk stuff crudely into raft.c.
2014-02-11 17:14:25 -08:00
Steve Dee
28fe4ec482 WIP rafty loop.c
_lo_save() sticks events on roe for processing in later calls to
_lo_work().
2014-02-11 13:13:30 -08:00
Steve Dee
580a7323f4 WIP Make _lo_work rafty
Carts are now batches of events waiting to be or just recently
persisted. _lo_work calls u2_reck_kick on the last batch of events,
removes every batch that's been through Raft, and then prepares the next
batch.

TODO make _lo_punk et al stick things on roe

TODO move disk persistence to raft.c

TODO raft_push: lo_open / mark / lo_shut
2014-02-11 12:57:41 -08:00
Steve Dee
d69aaf1491 Make u2_reck_plan push to roe 2014-02-10 16:07:22 -08:00
Steve Dee
85085f713e Move srand call, seed from pid 2014-02-10 16:07:22 -08:00
Steve Dee
5a16660af1 Skeleton for raft 2014-02-10 16:07:09 -08:00
Steve Dee
6df5fb3155 New-style raft options 2014-02-05 15:25:57 -08:00
Steve Dee
c91e950eb7 Add raft listener/peers 2014-02-05 15:25:57 -08:00
Steve Dee
fc51f17322 Add _main_readw 2014-02-05 15:25:57 -08:00
Curtis Yarvin
d5421bf717 Fix -I. 2014-02-03 21:55:19 +00:00
C. Guy Yarvin
a5fee9936b Various fixes and improvements. 2014-01-27 11:09:56 -08:00
Curtis Yarvin
00e218d76e Merge branch 'master' of github.com:urbit/urbit 2014-01-27 18:49:07 +00:00
Curtis Yarvin
ae489b86da Quick 64-bit fixes. 2014-01-27 18:48:55 +00:00
Steven Dee
1ab1528749 Warn about unset URBIT_HOME 2014-01-26 21:31:48 -08:00
C. Guy Yarvin
997c32f192 Various fixes and improvements. 2014-01-20 13:50:54 -08:00
Steve Dee
2b1077899e Add hostname 2014-01-17 09:42:47 -08:00
Steve Dee
ed09e5d12e Bring up listeners after boot 2014-01-17 00:12:05 -08:00
Steve Dee
97eeb27d41 Batch pier creation 2014-01-15 17:41:30 -08:00
Steve Dee
b8aec6e5d8 Get a random UDP port... 2014-01-15 13:00:47 -08:00
Steven Dee
d7052254fe Fix warning on implicit wait decl 2014-01-15 20:21:04 +00:00
Steve Dee
dcf3785363 Sort opts, remove unused -s 2014-01-15 11:59:08 -08:00
Steve Dee
4605ac9c66 Fix ames port logic
Hey, we have a -p flag. Neat.
2014-01-15 11:21:50 -08:00
Steve Dee
e434374855 Initialize por_s 2014-01-15 11:19:30 -08:00
Kingdon Barrett
7d19f2ed33 -p to demand a listen port in ames 2014-01-15 12:16:50 -05:00
Steve Dee
712968d37e Actually fix the history-eating bug 2014-01-14 18:37:45 -08:00
Steve Dee
bddcfefddd Hack to fix the history-eating bug 2014-01-14 18:13:58 -08:00
C. Guy Yarvin
6f1ad34345 Fix interrupt crash. 2014-01-07 10:43:50 -08:00
C. Guy Yarvin
3a59c5f0d4 Merge branch 'master' of github.com:urbit/urbit 2014-01-06 12:49:08 -08:00
C. Guy Yarvin
73ff3bb203 Merge branch 'funbreach'
Conflicts:
	urb/urbit.pill
2014-01-06 12:46:49 -08:00
C. Guy Yarvin
98006a2851 Last checkin on funbreach. 2014-01-06 12:37:42 -08:00
C. Guy Yarvin
2f83452f42 Refactor peek. 2014-01-05 16:02:34 -08:00
C. Guy Yarvin
a259e04a28 Various fixes and improvements. 2014-01-03 23:28:16 -08:00
Steve Dee
64a1d9a506 Update comment with current blip 2013-12-31 21:49:54 +01:00
Steve Dee
d95f2cc376 Proper daemon mode noun garbage fix 2013-12-29 17:30:45 +01:00
Steve Dee
f9a65caf9e Horrible hack to prevent lin from getting GCed
Fixes the daemon mode noun leak, sort of, if you squint at it. Better
solution soon to come.
2013-12-29 13:57:03 +01:00
Steve Dee
eff8a1ba45 Don't u2z(u2_nul) 2013-12-29 13:57:03 +01:00
Steve Dee
74bae0df22 Partially fix noun leak in daemon mode
Still some regular noun garbage being generated, but it's a bit less now.
2013-12-29 13:07:38 +01:00
C. Guy Yarvin
3855896562 Don't assert on missing files. 2013-12-26 14:35:00 -05:00
Steve Dee
aba13f1120 Output hi/lojacked fprintf in daemon mode 2013-12-19 10:37:01 -08:00
Steve Dee
a94ea80337 Alignment 2013-12-19 10:11:12 -08:00
Steve Dee
6542083861 Don't write \r in daemon mode 2013-12-19 10:10:57 -08:00
Steve Dee
a21336a3a8 hi/lojack ames fprintf 2013-12-19 10:10:11 -08:00
Steve Dee
0066cf7518 Get daemon mode actually working 2013-12-19 09:48:02 -08:00
Steve Dee
89ac00bd6a Write to stdout in daemon mode
Fixes nohup.
2013-12-18 15:21:18 -08:00
Steve Dee
262e9fb984 Remove \r from http notification 2013-12-18 15:13:48 -08:00
Steven Dee
f2a839426b Ye olde whitespace cleanup part 2
sed -i, glanced at.
2013-12-18 13:17:47 -08:00
Steve Dee
573267f05b Fix output in daemon mode 2013-12-18 13:17:47 -08:00
Steve Dee
011f20447c Realistically reintroduce accurate comment
This reverts commit c6e01a7c6ecdcbb2a0848f59b7db6641f0902773.
2013-12-17 16:50:09 -08:00
Steve Dee
d9e445c2ec Poll in u2_lo_loop
This fixes daemon mode.

Strictly speaking, the _lo_poll call is only necessary when we're
in daemon mode, but having our network code randomly work as a side
effect of polling for terminal input seems like a poor life choice,
so we do it unconditionally.
2013-12-17 13:02:32 -08:00
Steven Dee
60f68a9fd5 Optimistically removing bogus comment 2013-12-17 18:51:52 +00:00
Steve Dee
a75e974af9 Fix remaining non-libuv memory leaks
The only leaks remaining are in libuv's fsevents code. They could
be our fault, but it's unlikely.
2013-12-16 18:36:32 -08:00
Steven Dee
52385c8276 @ud format event counter 2013-12-11 23:30:46 -05:00
C. Guy Yarvin
3d9cda2509 Don't put empty directories in unix-built ankh. 2013-11-29 20:30:17 -08:00
C. Guy Yarvin
376a5ecbaa Really long timerz. 2013-11-26 18:16:17 -08:00
C. Guy Yarvin
2d370a347e Lengthen timer to 30s. Highly suspect. 2013-11-26 18:04:55 -08:00
C. Guy Yarvin
4ad3ce5bf7 Merge branch 'master' of github.com:urbit/urbit 2013-11-22 12:48:36 -08:00
C. Guy Yarvin
3d7bb85a1c Tiny change. 2013-11-22 12:45:37 -08:00
cgyarvin
85435d25e9 Merge pull request #88 from twopir/master
bail early when pier exists
2013-11-21 10:18:29 -08:00
C. Guy Yarvin
f592b16a59 Combat wake loops. 2013-11-20 22:43:12 -08:00
Pi
6d9007cdb2 bail early when pier exists
Because I'm tired of waiting for keygen to find out my pier already exists.
2013-11-20 13:25:53 -08:00
C. Guy Yarvin
8d779710c3 Fix playback bug for forwarded packets. 2013-11-18 14:31:51 -08:00
C. Guy Yarvin
66c4e463e9 Fix some http-parser bugs; clean up dill. 2013-11-13 21:25:24 -08:00
C. Guy Yarvin
538d60361a Correct lame:wake bug in a rather crude way. 2013-11-13 17:48:21 -08:00
C. Guy Yarvin
9b72ce7feb Show passcode file on load. 2013-11-13 11:45:17 -08:00
C. Guy Yarvin
33430d9fbc Fix bus errors with proper truncation. 2013-11-13 10:57:43 -08:00
C. Guy Yarvin
9c51f2cc10 Eliminate deadly "lame" printf. 2013-11-12 19:58:04 -08:00
C. Guy Yarvin
a4baea40fd Fix a bunch of memory leaks and stuff. 2013-11-11 23:09:11 -08:00
C. Guy Yarvin
91fe182f81 Various fixes and improvements... 2013-11-08 15:37:38 -08:00
Steven Dee
c489d2dc7d Remove remainder of sprintf & strcpy calls
Note that there are still some in libuv.
2013-11-01 15:10:41 -04:00
Curtis Yarvin
5b4c4437ce Merge branch 'master' of github.com:urbit/urbit 2013-10-31 17:20:57 +00:00
Curtis Yarvin
91adaea16a Fix SO_REUSEPORT issue in linux. 2013-10-31 17:20:42 +00:00
Steven Dee
ef40109ea9 Fix hom_w calculation 2013-10-30 16:59:57 -04:00
Steven Dee
324c6a235d Remove most instances of strcpy and sprintf
OpenBSD whines about these and recommends using strlcpy / snprintf
instead. Since strlcpy isn't quite universal yet, we use strncpy instead
and be careful about terminating the string. We could implement a
portable strlcpy in terms of strncpy, but that'd add another function to
the namespace.

Yes, usually the length is obviously bounded. Still, pretending
strcpy/sprintf don't exist seems like a great strategy.

N.B. there are still a few occurrences of strcpy and sprintf under f/
and in libuv, but I don't have time to tackle them right now.
2013-10-30 15:25:22 -04:00
C. Guy Yarvin
367838774a Fix broken build. 2013-10-30 11:42:24 -07:00
C. Guy Yarvin
549d090add Various fixes and improvements. 2013-10-30 11:26:51 -07:00
C. Guy Yarvin
25b7ed9a9c Various fixes and improvements. 2013-10-26 20:55:53 -07:00
C. Guy Yarvin
e6441de170 Correctly load original pill after checkpoint failure. 2013-10-23 14:48:14 -07:00
Steven Dee
d51339b885 Don't fork in daemon mode 2013-10-21 14:55:19 -04:00
Steven Dee
b0e2f692ac Exit 0 on successful daemonization 2013-10-21 13:13:53 -04:00
Curtis Yarvin
b0078e4c48 Add initial GC on startup; fix batz handling of %yu. 2013-10-19 06:10:25 +00:00
C. Guy Yarvin
91551d2f5a Changes for libuv bug reproduce. 2013-10-14 11:23:55 -07:00
Curtis Yarvin
6d091f5e07 Continuity breach, flag day. 2013-10-11 18:00:22 +00:00
Curtis Yarvin
ccccea982c More printfs... 2013-10-08 18:26:59 +00:00
Steven Dee
1a6f18d09d Consider both FreeBSD and OpenBSD "bsd" 2013-10-07 12:31:41 -04:00
C. Guy Yarvin
ab35a08774 Development "branch" goes back to production. 2013-10-06 00:44:07 -07:00
Curtis Yarvin
6671d85b86 Merge branch 'master' of github.com:urbit/urbit 2013-10-04 22:33:45 +00:00
Curtis Yarvin
323d010724 Fix a memory leak per packet. 2013-10-04 22:33:26 +00:00
David Nadle
abac35c6eb Handle autosave SIGCHLD with no stored pid 2013-10-04 03:07:47 -04:00
C. Guy Yarvin
fdf68275ed Hub before clay/ze refactor. 2013-10-03 13:38:37 -07:00
C. Guy Yarvin
3e0fe1bd0e Merge branch 'master' of github.com:urbit/urbit 2013-10-02 09:41:15 -07:00
C. Guy Yarvin
e7e0842eaa Experiments with fork checkpoint. 2013-10-02 09:40:58 -07:00
Lev Serebryakov
018cfe5eaf Quick'n'dirty port to FreeBSD (checked on FreeBSD 9.2/amd64) 2013-10-02 18:44:22 +04:00
Christian Carter
3af3130bdc Cleaning up old code 2013-09-28 13:21:18 -07:00