Skip to content

Instantly share code, notes, and snippets.

@nponeccop
Last active October 24, 2016 22:18
Show Gist options
  • Save nponeccop/446b0547f3942be0f41b51105c4b02d2 to your computer and use it in GitHub Desktop.
Save nponeccop/446b0547f3942be0f41b51105c4b02d2 to your computer and use it in GitHub Desktop.
digraph smtp {
init -> A [label=greet];
A -> done [label=ehlo];
}
const patterns = {
init_greet : (q, data) => {
data
.command('EHLO ...')
.done(q => q.resolve('A'))
}
A_ehlo : (q, data) => {
q.resolve('done')
}
}
function handle(q, state, event, data)
{
const k = state + _ + event;
if (k in patterns)
{
patterns[k](q, data)
}
else
{
q.resolve('done')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment