Merge branch 'master' of github.com:urbit/urbit

This commit is contained in:
C. Guy Yarvin 2013-10-04 22:34:39 -07:00
commit 939521fc58
2 changed files with 27 additions and 7 deletions

View File

@ -28,7 +28,19 @@
static uv_buf_t
_ames_alloc(uv_handle_t* had_u, size_t len_i)
{
return uv_buf_init(malloc(len_i), len_i);
void* ptr_v = malloc(len_i);
// uL(fprintf(uH, "grab %p\n", ptr_v));
return uv_buf_init(ptr_v, len_i);
}
/* _ames_free(): contrasting free.
*/
static void
_ames_free(void* ptr_v)
{
// uL(fprintf(uH, "free %p\n", ptr_v));
free(ptr_v);
}
/* _ames_czar(): quasi-static route to emperor.
@ -235,10 +247,10 @@ _ames_recv_cb(uv_udp_t* wax_u,
struct sockaddr* adr_u,
unsigned flg_i)
{
// fprintf(stderr, "ames: rx\r\n");
// uL(fprintf(uH, "ames: rx %p\r\n", buf_u.base));
if ( 0 == nrd_i ) {
free(buf_u.base);
_ames_free(buf_u.base);
}
else {
u2_lo_open();
@ -254,6 +266,7 @@ _ames_recv_cb(uv_udp_t* wax_u,
u2nt(c3__gold, c3__ames, u2_nul),
u2nt(c3__hear, u2nt(c3__if, por_s, u2_ci_words(1, &pip_w)), msg));
}
_ames_free(buf_u.base);
u2_lo_shut(u2_yes);
}
}

View File

@ -29,14 +29,13 @@ _save_time_cb(uv_timer_t* tim_u, c3_i sas_i)
}
if ( u2A->ent_w > sav_u->ent_w ) {
c3_w pid_w;
// uL(fprintf(uH, "autosaving... ent_w %d\n", u2A->ent_w));
u2_cm_purge();
// u2_ve_grab(0);
#ifdef FORKPT
c3_w pid_w;
if ( 0 == (pid_w = fork()) ) {
u2_loom_save(u2A->ent_w);
exit(0);
@ -63,10 +62,18 @@ u2_save_ef_chld(void)
c3_i loc_i;
c3_w pid_w;
c3_assert(0 != sav_u->pid_w);
/* modified for cases with no pid_w
*/
uL(fprintf(uH, "checkpoint: complete %d\n", sav_u->pid_w));
pid_w = wait(&loc_i);
c3_assert(pid_w == sav_u->pid_w);
if (0 != sav_u->pid_w)
{
c3_assert(pid_w == sav_u->pid_w);
}
else
{
c3_assert(pid_w > 0);
}
sav_u->pid_w = 0;
}