-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ames: handle %nail gift, lanes to vere cache #541
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fb18089
ames: handle %nail gift, lanes to vere cache
pkova 4b523ad
ames: wait for %nail before enabling new lane cache behavior
pkova 1e24bfb
ames: convert nal_d from c3_d to co_o
pkova c6dbc60
ames: rename nal_d to nal_o
pkova d1a4e34
ames: fix _ames_lane_from_cache logic to return the head always
pkova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
c3_w imp_w[256]; // imperial IPs | ||
time_t imp_t[256]; // imperial IP timestamps | ||
c3_o imp_o[256]; // imperial print status | ||
c3_o nal_d; // lane cache backcompat flag | ||
struct { // config: | ||
c3_o net_o; // can send | ||
c3_o see_o; // can scry | ||
|
@@ -920,13 +921,13 @@ _ames_lane_into_cache(u3p(u3h_root) lax_p, u3_noun who, u3_noun las) { | |
u3z(who); | ||
} | ||
|
||
/* _ames_lane_from_cache(): retrieve lane for who from cache, if any & fresh | ||
/* _ames_lane_from_cache(): retrieve lane for who from cache, if any | ||
*/ | ||
static u3_weak | ||
_ames_lane_from_cache(u3p(u3h_root) lax_p, u3_noun who) { | ||
_ames_lane_from_cache(u3p(u3h_root) lax_p, u3_noun who, c3_o nal) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/b |
||
u3_weak lac = u3h_git(lax_p, who); | ||
|
||
if ( u3_none != lac ) { | ||
if (nal == c3n && u3_none != lac ) { | ||
struct timeval tim_tv; | ||
gettimeofday(&tim_tv, 0); | ||
u3_noun now = u3_time_in_tv(&tim_tv); | ||
|
@@ -1477,7 +1478,7 @@ _ames_try_send(u3_pact* pac_u, c3_o for_o) | |
// | ||
else { | ||
u3_noun key = u3i_chubs(2, pac_u->pre_u.rec_d); | ||
lac = _ames_lane_from_cache(sam_u->lax_p, key); | ||
lac = _ames_lane_from_cache(sam_u->lax_p, key, sam_u->nal_d); | ||
} | ||
|
||
// if we know there's no lane, drop the packet | ||
|
@@ -2276,6 +2277,14 @@ _ames_kick_newt(u3_ames* sam_u, u3_noun tag, u3_noun dat) | |
_ames_ef_turf(sam_u, u3k(dat)); | ||
ret_o = c3y; | ||
} break; | ||
|
||
case c3__nail: { | ||
u3_noun who = u3k(u3h(dat)); | ||
u3_noun las = u3k(u3t(dat)); | ||
_ames_lane_into_cache(sam_u->lax_p, who, las); | ||
sam_u->nal_d = c3y; | ||
ret_o = c3y; | ||
} break; | ||
} | ||
|
||
u3z(tag); u3z(dat); | ||
|
@@ -2457,6 +2466,7 @@ u3_ames_io_init(u3_pier* pir_u) | |
{ | ||
u3_ames* sam_u = c3_calloc(sizeof(*sam_u)); | ||
sam_u->pir_u = pir_u; | ||
sam_u->nal_d = c3n; | ||
sam_u->fig_u.net_o = c3y; | ||
sam_u->fig_u.see_o = c3y; | ||
sam_u->fig_u.fit_o = c3n; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/b
nal_o