#
#
# add_dir "tests/exchanging_work_via_netsync_sent_notes"
#
# add_file "tests/exchanging_work_via_netsync_sent_notes/__driver__.lua"
# content [b3e4e1a2107d853ada4ea0e9b76054b50a9aade9]
#
# add_file "tests/exchanging_work_via_netsync_sent_notes/testnotes.test"
# content [bdeb5898f6e24cb6c290eb48ae341fd475aa3093]
#
# add_file "tests/exchanging_work_via_netsync_sent_notes/testnotes2.test"
# content [c30f659acb8f0c80f2c56d899f46e5913e9bf3f8]
#
# patch "NEWS"
# from [72bf0457e290fdae5f440ce81c7531fc65a88fc4]
# to [10532f72d9805e7c4b45c6c829f8fea0bfd844d7]
#
# patch "examples/display_branches.lua"
# from [656dc06747a5e55e1c1300b32bb25f13e140b758]
# to [66f8252a6b8b91075061633e972c12fd1ade65bf]
#
# patch "lua_hooks.cc"
# from [a747d898e036539c69beba100f6a67e1491b6f96]
# to [c20c2f1a435898af47853fc2f62a85f746125d57]
#
# patch "lua_hooks.hh"
# from [1ad28362eb6d5a4dd2939b7b619caa0a48adae45]
# to [b5cd54bb2cc7139b2fa3a508af726c4197826e1d]
#
# patch "monotone.texi"
# from [c645706bac188f62662ddbaeb5830c0209cabe04]
# to [090e6ef0d1bea17258b0ffe86c9fa22b703cb7de]
#
# patch "netsync.cc"
# from [65e1a56ee8b696d881bd5761e1ab7af77edb0295]
# to [4387f8b327d8841a069df2e25c6bc00075db4632]
#
# patch "std_hooks.lua"
# from [9fd3160c435eff59acc8622875047304e3472b9c]
# to [f70deee23a8637fbc54f7eddd5275165258b103e]
#
# patch "tests/common/netsync-hooks_with_notes.lua"
# from [3f41c5f99a2252ec2d0e9773ef1833cd2a96ba7b]
# to [23eb7776aa35c7b2e27c58a49c1226dd1ef46581]
#
============================================================
--- tests/exchanging_work_via_netsync_sent_notes/__driver__.lua b3e4e1a2107d853ada4ea0e9b76054b50a9aade9
+++ tests/exchanging_work_via_netsync_sent_notes/__driver__.lua b3e4e1a2107d853ada4ea0e9b76054b50a9aade9
@@ -0,0 +1,69 @@
+-- Test note_netsync_*_sent hooks
+--
+-- Similar to
+-- ../exchanging_work_via_netsync,_with_notes/__driver__.lua, but here
+-- we do "push" instead of "pull".
+
+include("common/netsync.lua")
+mtn_setup()
+netsync.setup_with_notes()
+revs = {}
+
+remove("_MTN")
+check(mtn2("setup", "--branch=testbranch"), 0, nil, nil)
+
+function noterev()
+ local t = {}
+ t.f = sha1("testfile")
+ t.rev = base_revision()
+ t.man = base_manifest()
+ t.date = certvalue(t.rev, "date")
+ table.insert(revs, t)
+end
+
+function evaluate(correctfile, logfile)
+ check(get(correctfile))
+ local dat = readfile(correctfile)
+ dat = string.gsub(dat, "REV1", revs[1].rev)
+ dat = string.gsub(dat, "MAN1", revs[1].man)
+ dat = string.gsub(dat, "FILE1", revs[1].f)
+ dat = string.gsub(dat, "DATE1", revs[1].date)
+ dat = string.gsub(dat, "REV2", revs[2].rev)
+ dat = string.gsub(dat, "MAN2", revs[2].man)
+ dat = string.gsub(dat, "FILE2", revs[2].f)
+ dat = string.gsub(dat, "DATE2", revs[2].date)
+ writefile(correctfile, dat)
+
+ canonicalize(logfile)
+ dat = readfile(logfile)
+ dat = string.gsub(dat, "^%d+ ", "")
+ dat = string.gsub(dat, "\n%d+ ", "\n")
+ dat = string.gsub(dat, "\n[^\n]*remote_host[^\n]*\n", "\n")
+ dat = string.gsub(dat, "\n[^\n]*bytes in/out[^\n]*\n", "\n")
+ writefile(logfile, dat)
+
+ check(samefile(logfile, correctfile))
+end
+
+-- Checking the effect of a new revisions
+writefile("testfile", "version 0 of test file")
+check(mtn2("add", "testfile"), 0, false, false)
+commit("testbranch", "blah-blah", mtn2)
+noterev()
+
+writefile("testfile", "version 1 of test file")
+commit("testbranch", "blah-blah", mtn2)
+noterev()
+
+netsync.push("testbranch")
+
+evaluate("testnotes.test", "testnotes-client.log")
+
+-- Checking the effect of a simple cert change
+check(mtn2("tag", revs[1].rev, "testtag"), 0, false, false)
+
+netsync.push("testbranch")
+
+evaluate("testnotes2.test", "testnotes-client.log")
+
+-- end of file
============================================================
--- tests/exchanging_work_via_netsync_sent_notes/testnotes.test bdeb5898f6e24cb6c290eb48ae341fd475aa3093
+++ tests/exchanging_work_via_netsync_sent_notes/testnotes.test bdeb5898f6e24cb6c290eb48ae341fd475aa3093
@@ -0,0 +1,60 @@
+start ---------------------------------------------------
+start: sync_type = push
+start: remote_keyname = address@hidden
+start: includes = testbranch
+start: excludes =
+sent pubkey: address@hidden
+sent revision: new_id = REV1
+sent revision: revision = format_version "1"
+
+new_manifest [MAN1]
+
+old_revision []
+
+add_dir ""
+
+add_file "testfile"
+ content [FILE1]
+
+sent revision: cert.name = author
+sent revision: cert.value = address@hidden
+sent revision: cert.key = address@hidden
+sent revision: cert.name = branch
+sent revision: cert.value = testbranch
+sent revision: cert.key = address@hidden
+sent revision: cert.name = changelog
+sent revision: cert.value = blah-blah
+
+sent revision: cert.key = address@hidden
+sent revision: cert.name = date
+sent revision: cert.value = DATE1
+sent revision: cert.key = address@hidden
+sent revision: new_id = REV2
+sent revision: revision = format_version "1"
+
+new_manifest [MAN2]
+
+old_revision [REV1]
+
+patch "testfile"
+ from [FILE1]
+ to [FILE2]
+
+sent revision: cert.name = author
+sent revision: cert.value = address@hidden
+sent revision: cert.key = address@hidden
+sent revision: cert.name = branch
+sent revision: cert.value = testbranch
+sent revision: cert.key = address@hidden
+sent revision: cert.name = changelog
+sent revision: cert.value = blah-blah
+
+sent revision: cert.key = address@hidden
+sent revision: cert.name = date
+sent revision: cert.value = DATE2
+sent revision: cert.key = address@hidden
+end: status = 200
+end: certs in/out = 0/8
+end: revs in/out = 0/2
+end: keys in/out = 0/1
+end -----------------------------------------------------
============================================================
--- tests/exchanging_work_via_netsync_sent_notes/testnotes2.test c30f659acb8f0c80f2c56d899f46e5913e9bf3f8
+++ tests/exchanging_work_via_netsync_sent_notes/testnotes2.test c30f659acb8f0c80f2c56d899f46e5913e9bf3f8
@@ -0,0 +1,14 @@
+start ---------------------------------------------------
+start: sync_type = push
+start: remote_keyname = address@hidden
+start: includes = testbranch
+start: excludes =
+sent cert: rev_id = REV1
+sent cert: name = tag
+sent cert: value = testtag
+sent cert: key = address@hidden
+end: status = 200
+end: certs in/out = 0/1
+end: revs in/out = 0/0
+end: keys in/out = 0/0
+end -----------------------------------------------------
============================================================
--- NEWS 72bf0457e290fdae5f440ce81c7531fc65a88fc4
+++ NEWS 10532f72d9805e7c4b45c6c829f8fea0bfd844d7
@@ -34,12 +34,18 @@
the output of the command did not get into the right output
channel; this has been fixed
+ - mtn would produce a warning if executed from the root
+ directory of a Windows drive; this has been fixed.
+
New features
- Add 'automate show_conflicts' command
- Add 'automate get_workspce_root' command
+ - Add Lua hooks 'note_netsync_revision_sent',
+ 'note_netsync_cert_sent', 'note_netsync_pubkey_sent'
+
Internal
Fri Apr 11 22:50:44 UTC 2008
============================================================
--- examples/display_branches.lua 656dc06747a5e55e1c1300b32bb25f13e140b758
+++ examples/display_branches.lua 66f8252a6b8b91075061633e972c12fd1ade65bf
@@ -18,23 +18,46 @@ do
end
end
+ netsync_sent_branches = {}
+ function _note_netsync_cert_sent(rev_id,key,name,value,nonce)
+ if name == "branch" then
+ if netsync_sent_branches[nonce][value] == nil then
+ netsync_sent_branches[nonce][value] = 1
+ else
+ netsync_sent_branches[nonce][value] = netsync_sent_branches[nonce][value] + 1
+ end
+ end
+ end
+
push_netsync_notifier(
{
- [start] =
+ ["start"] =
function (nonce)
netsync_branches[nonce] = {}
+ netsync_sent_branches[nonce] = {}
end,
- [revision_received] =
+ ["revision_received"] =
function (new_id,revision,certs,nonce)
for _, item in pairs(certs)
do
_note_netsync_cert_received(new_id,item.key,item.name,item.value,nonce)
end
end,
- [cert_received] =
+ ["revision_sent"] =
+ function (new_id,revision,certs,nonce)
+ for _, item in pairs(certs)
+ do
+ _note_netsync_cert_sent(new_id,item.key,item.name,item.value,nonce)
+ end
+ end,
+ ["cert_received"] =
function (rev_id,key,name,value,nonce)
_note_netsync_cert_received(rev_id,key,name,value,nonce)
end,
+ ["cert_sent"] =
+ function (rev_id,key,name,value,nonce)
+ _note_netsync_cert_sent(rev_id,key,name,value,nonce)
+ end,
["end"] =
function (nonce, status)
-- only try to display results if we got
@@ -47,12 +70,23 @@ do
for item, amount in pairs(netsync_branches[nonce])
do
if first then
- io.stderr:write("Affected branches:\n")
+ io.stderr:write("Received data on branches:\n")
first = false
end
io.stderr:write(" ",item," (",amount,")\n")
end
netsync_branches[nonce] = nil
+
+ first = true
+ for item, amount in pairs(netsync_sent_branches[nonce])
+ do
+ if first then
+ io.stderr:write("Sent data on branches:\n")
+ first = false
+ end
+ io.stderr:write(" ",item," (",amount,")\n")
+ end
+ netsync_sent_branches[nonce] = nil
end
})
end
============================================================
--- lua_hooks.cc a747d898e036539c69beba100f6a67e1491b6f96
+++ lua_hooks.cc c20c2f1a435898af47853fc2f62a85f746125d57
@@ -1,3 +1,4 @@
+// Copyright (C) 2008 Stephen Leake
// Copyright (C) 2002 Graydon Hoare
//
// This program is made available under the GNU GPL version 2.0 or
@@ -111,7 +112,7 @@ lua_hooks::lua_hooks(app_state * app)
"io.popen = function(c,t) "
" error(\"io.popen disabled for security reasons. Try spawn_pipe().\") "
"end ";
-
+
if (!run_string(st, disable_dangerous,
""))
throw oops("lua error while disabling existing functions");
@@ -906,9 +907,9 @@ lua_hooks::hook_note_netsync_revision_re
bool
lua_hooks::hook_note_netsync_revision_received(revision_id const & new_id,
revision_data const & rdat,
- set > > const & certs,
+ set > > const & certs,
size_t session_id)
{
Lua ll(st);
@@ -941,6 +942,43 @@ bool
}
bool
+lua_hooks::hook_note_netsync_revision_sent(revision_id const & new_id,
+ revision_data const & rdat,
+ set > > const & certs,
+ size_t session_id)
+{
+ Lua ll(st);
+ ll
+ .func("note_netsync_revision_sent")
+ .push_str(encode_hexenc(new_id.inner()()))
+ .push_str(rdat.inner()());
+
+ ll.push_table();
+
+ typedef set > > cdat;
+
+ int n = 1;
+ for (cdat::const_iterator i = certs.begin(); i != certs.end(); ++i)
+ {
+ ll.push_int(n++);
+ ll.push_table();
+ ll.push_str(i->first());
+ ll.set_field("key");
+ ll.push_str(i->second.first());
+ ll.set_field("name");
+ ll.push_str(i->second.second());
+ ll.set_field("value");
+ ll.set_table();
+ }
+
+ ll.push_int(session_id);
+ ll.call(4, 0);
+ return ll.ok();
+}
+
+bool
lua_hooks::hook_note_netsync_pubkey_received(rsa_keypair_id const & kid,
size_t session_id)
{
@@ -955,6 +993,20 @@ bool
}
bool
+lua_hooks::hook_note_netsync_pubkey_sent(rsa_keypair_id const & kid,
+ size_t session_id)
+{
+ Lua ll(st);
+ ll
+ .func("note_netsync_pubkey_sent")
+ .push_str(kid())
+ .push_int(session_id);
+
+ ll.call(2, 0);
+ return ll.ok();
+}
+
+bool
lua_hooks::hook_note_netsync_cert_received(revision_id const & rid,
rsa_keypair_id const & kid,
cert_name const & name,
@@ -975,6 +1027,26 @@ bool
}
bool
+lua_hooks::hook_note_netsync_cert_sent(revision_id const & rid,
+ rsa_keypair_id const & kid,
+ cert_name const & name,
+ cert_value const & value,
+ size_t session_id)
+{
+ Lua ll(st);
+ ll
+ .func("note_netsync_cert_sent")
+ .push_str(encode_hexenc(rid.inner()()))
+ .push_str(kid())
+ .push_str(name())
+ .push_str(value())
+ .push_int(session_id);
+
+ ll.call(5, 0);
+ return ll.ok();
+}
+
+bool
lua_hooks::hook_note_netsync_end(size_t session_id, int status,
size_t bytes_in, size_t bytes_out,
size_t certs_in, size_t certs_out,
@@ -1042,13 +1114,13 @@ void commands::cmd_lua::exec(app_state &
{
I(st);
I(app.lua.check_lua_state(st));
-
+
app_state* app_p = get_app_state(st);
I(app_p == & app);
Lua ll(st);
ll.func(f_name);
-
+
for (args_vector::const_iterator it = args.begin(); it != args.end(); ++it)
ll.push_str((*it)());
@@ -1087,12 +1159,12 @@ LUAEXT(register_command, )
const char *cmd_abstract = luaL_checkstring(L, -3);
const char *cmd_desc = luaL_checkstring(L, -2);
const char *cmd_func = luaL_checkstring(L, -1);
-
+
N(cmd_name && cmd_params && cmd_abstract && cmd_desc && cmd_func,
F("%s called with an invalid parameter") % "register_command");
-
+
new commands::cmd_lua(cmd_name, cmd_params, cmd_abstract, cmd_desc, L, cmd_func); // leak this - commands can't be removed anyway
-
+
lua_pushboolean(L, true);
return 1;
}
============================================================
--- lua_hooks.hh 1ad28362eb6d5a4dd2939b7b619caa0a48adae45
+++ lua_hooks.hh b5cd54bb2cc7139b2fa3a508af726c4197826e1d
@@ -1,6 +1,7 @@
#ifndef __LUA_HOOKS_HH__
#define __LUA_HOOKS_HH__
+// Copyright (C) 2008 Stephen Leake
// Copyright (C) 2002 Graydon Hoare
//
// This program is made available under the GNU GPL version 2.0 or
@@ -35,7 +36,7 @@ class lua_hooks
void add_std_hooks();
void load_rcfile(utf8 const & file);
void load_rcfile(any_path const & file, bool required);
-
+
public:
lua_hooks(app_state * app);
~lua_hooks();
@@ -85,7 +86,7 @@ public:
bool debug,
std::vector & argv);
bool hook_use_transport_auth(uri const & u);
-
+
bool hook_get_netsync_read_permitted(std::string const & branch,
rsa_keypair_id const & identity);
// anonymous no-key version
@@ -147,17 +148,30 @@ public:
globish exclude_pattern);
bool hook_note_netsync_revision_received(revision_id const & new_id,
revision_data const & rdat,
- std::set > > const & certs,
+ std::set > > const & certs,
size_t session_id);
+ bool hook_note_netsync_revision_sent(revision_id const & new_id,
+ revision_data const & rdat,
+ std::set > > const & certs,
+ size_t session_id);
bool hook_note_netsync_pubkey_received(rsa_keypair_id const & kid,
size_t session_id);
+ bool hook_note_netsync_pubkey_sent(rsa_keypair_id const & kid,
+ size_t session_id);
bool hook_note_netsync_cert_received(revision_id const & rid,
rsa_keypair_id const & kid,
cert_name const & name,
cert_value const & value,
size_t session_id);
+ bool hook_note_netsync_cert_sent(revision_id const & rid,
+ rsa_keypair_id const & kid,
+ cert_name const & name,
+ cert_value const & value,
+ size_t session_id);
bool hook_note_netsync_end(size_t session_id, int status,
size_t bytes_in, size_t bytes_out,
size_t certs_in, size_t certs_out,
============================================================
--- monotone.texi c645706bac188f62662ddbaeb5830c0209cabe04
+++ monotone.texi 090e6ef0d1bea17258b0ffe86c9fa22b703cb7de
@@ -9059,6 +9059,12 @@ @subsection Event Notifications and Trig
@code{note_netsync_end}. If you're not interested in that type of
tracking, you can ignore that variable entirely.
address@hidden note_netsync_revision_sent (@var{rev_id}, @var{revision}, @var{certs}, @var{session_id})
+
+Called by monotone after the revision @var{rev_id} is sent through
+netsync. The arguments are the same as for
address@hidden
+
@item note_netsync_cert_received (@var{rev_id}, @var{key}, @var{name}, @var{value}, @var{session_id})
Called by monotone after a cert is received through netsync, if the revision
@@ -9071,6 +9077,13 @@ @subsection Event Notifications and Trig
@code{note_netsync_end}. If you're not interested in that type of
tracking, you can ignore that variable entirely.
address@hidden note_netsync_cert_sent (@var{rev_id}, @var{key}, @var{name}, @var{value}, @var{session_id})
+
+Called by monotone after a cert is sent through netsync, if the revision
+that the cert is attached to was not also sent in the same netsync
+operation. The arguments are the same as for
address@hidden
+
@item note_netsync_pubkey_received (@var{keyname}, @var{session_id})
Called by monotone after a pubkey is received through netsync. @var{keyname}
@@ -9079,6 +9092,11 @@ @subsection Event Notifications and Trig
@code{note_netsync_end}. If you're not interested in that type of
tracking, you can ignore that variable entirely.
address@hidden note_netsync_pubkey_sent (@var{keyname}, @var{session_id})
+
+Called by monotone after a pubkey is sent through netsync. The arguments are the same as for
address@hidden
+
@item note_netsync_end (@var{session_id}, @var{status},
@var{bytes_in}, @var{bytes_out}, @var{certs_in}, @var{certs_out},
@var{revs_in}, @var{revs_out}, @var{keys_in}, @var{keys_out})
============================================================
--- netsync.cc 65e1a56ee8b696d881bd5761e1ab7af77edb0295
+++ netsync.cc 4387f8b327d8841a069df2e25c6bc00075db4632
@@ -1,3 +1,4 @@
+// Copyright (C) 2008 Stephen Leake
// Copyright (C) 2004 Graydon Hoare
//
// This program is made available under the GNU GPL version 2.0 or
@@ -368,10 +369,16 @@ session:
size_t session_id;
static size_t session_count;
+ // These are read from the server, written to the local database
vector written_revisions;
vector written_keys;
vector written_certs;
+ // These are sent to the server
+ vector sent_revisions;
+ vector sent_keys;
+ vector sent_certs;
+
id saved_nonce;
enum
@@ -608,23 +615,22 @@ session::~session()
keys_in || keys_out))
error_code = partial_transfer;
- vector unattached_certs;
- map > revcerts;
+ vector unattached_written_certs;
+ map > rev_written_certs;
for (vector::iterator i = written_revisions.begin();
i != written_revisions.end(); ++i)
- revcerts.insert(make_pair(*i, vector()));
+ rev_written_certs.insert(make_pair(*i, vector()));
for (vector::iterator i = written_certs.begin();
i != written_certs.end(); ++i)
{
map >::iterator j;
- j = revcerts.find(revision_id(i->ident));
- if (j == revcerts.end())
- unattached_certs.push_back(*i);
+ j = rev_written_certs.find(revision_id(i->ident));
+ if (j == rev_written_certs.end())
+ unattached_written_certs.push_back(*i);
else
j->second.push_back(*i);
}
- // if (role == sink_role || role == source_and_sink_role)
if (!written_keys.empty()
|| !written_revisions.empty()
|| !written_certs.empty())
@@ -641,7 +647,7 @@ session::~session()
for (vector::iterator i = written_revisions.begin();
i != written_revisions.end(); ++i)
{
- vector & ctmp(revcerts[*i]);
+ vector & ctmp(rev_written_certs[*i]);
set > > certs;
for (vector::const_iterator j = ctmp.begin();
j != ctmp.end(); ++j)
@@ -654,11 +660,63 @@ session::~session()
}
//Certs (not attached to a new revision)
- for (vector::iterator i = unattached_certs.begin();
- i != unattached_certs.end(); ++i)
+ for (vector::iterator i = unattached_written_certs.begin();
+ i != unattached_written_certs.end(); ++i)
lua.hook_note_netsync_cert_received(revision_id(i->ident), i->key,
i->name, i->value, session_id);
}
+
+ if (!sent_keys.empty()
+ || !sent_revisions.empty()
+ || !sent_certs.empty())
+ {
+
+ vector unattached_sent_certs;
+ map > rev_sent_certs;
+ for (vector::iterator i = sent_revisions.begin();
+ i != sent_revisions.end(); ++i)
+ rev_sent_certs.insert(make_pair(*i, vector()));
+ for (vector::iterator i = sent_certs.begin();
+ i != sent_certs.end(); ++i)
+ {
+ map >::iterator j;
+ j = rev_sent_certs.find(revision_id(i->ident));
+ if (j == rev_sent_certs.end())
+ unattached_sent_certs.push_back(*i);
+ else
+ j->second.push_back(*i);
+ }
+
+ //Keys
+ for (vector::iterator i = sent_keys.begin();
+ i != sent_keys.end(); ++i)
+ {
+ lua.hook_note_netsync_pubkey_sent(*i, session_id);
+ }
+
+ //Revisions
+ for (vector::iterator i = sent_revisions.begin();
+ i != sent_revisions.end(); ++i)
+ {
+ vector & ctmp(rev_sent_certs[*i]);
+ set > > certs;
+ for (vector::const_iterator j = ctmp.begin();
+ j != ctmp.end(); ++j)
+ certs.insert(make_pair(j->key, make_pair(j->name, j->value)));
+
+ revision_data rdat;
+ project.db.get_revision(*i, rdat);
+ lua.hook_note_netsync_revision_sent(*i, rdat, certs,
+ session_id);
+ }
+
+ //Certs (not attached to a new revision)
+ for (vector::iterator i = unattached_sent_certs.begin();
+ i != unattached_sent_certs.end(); ++i)
+ lua.hook_note_netsync_cert_sent(revision_id(i->ident), i->key,
+ i->name, i->value, session_id);
+ }
+
lua.hook_note_netsync_end(session_id, error_code,
bytes_in, bytes_out,
certs_in, certs_out,
@@ -718,6 +776,7 @@ session::note_rev(revision_id const & re
data tmp;
write_revision(rs, tmp);
queue_data_cmd(revision_item, rev.inner(), tmp());
+ sent_revisions.push_back(rev);
}
void
@@ -730,6 +789,7 @@ session::note_cert(id const & c)
project.db.get_revision_cert(c, cert);
write_cert(cert.inner(), str);
queue_data_cmd(cert_item, c, str);
+ sent_certs.push_back(cert.inner());
}
@@ -1883,6 +1943,7 @@ session::load_data(netcmd_item_type type
project.db.get_pubkey(item, keyid, pub);
L(FL("public key '%s' is also called '%s'") % hitem() % keyid);
write_pubkey(keyid, pub, out);
+ sent_keys.push_back(keyid);
}
break;
============================================================
--- std_hooks.lua 9fd3160c435eff59acc8622875047304e3472b9c
+++ std_hooks.lua f70deee23a8637fbc54f7eddd5275165258b103e
@@ -1170,7 +1170,8 @@ do
local hook_functions = {}
local supported_items = {
"startup",
- "start", "revision_received", "cert_received", "pubkey_received", "end"
+ "start", "revision_received", "revision_sent", "cert_received", "cert_sent",
+ "pubkey_received", "pubkey_sent", "end"
}
function _hook_functions_helper(f,...)
@@ -1195,12 +1196,21 @@ do
function note_netsync_revision_received(...)
return _hook_functions_helper("revision_received",...)
end
+ function note_netsync_revision_sent(...)
+ return _hook_functions_helper("revision_sent",...)
+ end
function note_netsync_cert_received(...)
return _hook_functions_helper("cert_received",...)
end
+ function note_netsync_cert_sent(...)
+ return _hook_functions_helper("cert_sent",...)
+ end
function note_netsync_pubkey_received(...)
return _hook_functions_helper("pubkey_received",...)
end
+ function note_netsync_pubkey_sent(...)
+ return _hook_functions_helper("pubkey_sent",...)
+ end
function note_netsync_end(...)
return _hook_functions_helper("end",...)
end
============================================================
--- tests/common/netsync-hooks_with_notes.lua 3f41c5f99a2252ec2d0e9773ef1833cd2a96ba7b
+++ tests/common/netsync-hooks_with_notes.lua 23eb7776aa35c7b2e27c58a49c1226dd1ef46581
@@ -23,6 +23,17 @@ end
end
end
+function note_netsync_revision_sent(new_id, revision, certs, session_id)
+ logfile:write(session_id .. " sent revision: new_id = " .. new_id .. "\n")
+ logfile:write(session_id .. " sent revision: revision = " .. revision .. "\n")
+ for i, cert in pairs(certs)
+ do
+ logfile:write(session_id .. " sent revision: cert.name = " .. cert.name .. "\n")
+ logfile:write(session_id .. " sent revision: cert.value = " .. cert.value .. "\n")
+ logfile:write(session_id .. " sent revision: cert.key = " .. cert.key .. "\n")
+ end
+end
+
function note_netsync_cert_received(rev_id, key, name, value, session_id)
logfile:write(session_id .. " cert: rev_id = " .. rev_id .. "\n")
logfile:write(session_id .. " cert: name = " .. name .. "\n")
@@ -30,10 +41,21 @@ end
logfile:write(session_id .. " cert: key = " .. key .. "\n")
end
+function note_netsync_cert_sent(rev_id, key, name, value, session_id)
+ logfile:write(session_id .. " sent cert: rev_id = " .. rev_id .. "\n")
+ logfile:write(session_id .. " sent cert: name = " .. name .. "\n")
+ logfile:write(session_id .. " sent cert: value = " .. value .. "\n")
+ logfile:write(session_id .. " sent cert: key = " .. key .. "\n")
+end
+
function note_netsync_pubkey_received(keyname, session_id)
logfile:write(session_id .. " pubkey: " .. keyname .. "\n")
end
+function note_netsync_pubkey_sent(keyname, session_id)
+ logfile:write(session_id .. " sent pubkey: " .. keyname .. "\n")
+end
+
function note_netsync_end(session_id, status,
bytes_in, bytes_out,
certs_in, certs_out,