我正在尝试通过标准库SMTP软件包发送邮件,并且它在10分钟内什么都不做,然后因无法理解的文件结束错误而无法理解.
// excerpt from the calling function
// --- snip ---
if e := mailNotify(board, validPosts, ipMinusPort, delTime); e != nil {
errorPage(w, tmpl, "Contact Administrator",
"Email notification failed, please contact archive admin.")
log.Println("ERROR: Failed to send notification email: " + e.Error())
}
// --- snip ---
func mailNotify(board *config.Board, validPosts []int64,
ip string, delTime time.Time) error {
addresses := strings.Split(board.NotifyAddr, ",")
if len(addresses) < 1 {
return nil
}
msg := new(bytes.Buffer)
type values struct {
IP string
Posts …Run Code Online (Sandbox Code Playgroud) 作为玩具项目的一部分,我一直在尝试对其他人基于 flex/bison 的解析器进行小修改。我真的没有经验。您可以在这里找到原始解析器。
我一直在尝试组合一个简单的函数,该函数接受字符串并返回解析树,因此我可以通过 FFI 公开它以在另一种编程语言中使用。我所拥有的主要是基于main()原始程序中的功能,我的屠宰版本如下:
TreeNode* parse_string(char *s)
{
FILE *in = fmemopen(s, strlen(s), "r");
lex2_initialise();
parse_file(in);
fclose(in);
preprocess_tokens();
yyparse();
return top;
}
Run Code Online (Sandbox Code Playgroud)
这实际上工作得很好,至少在我第一次调用它时是这样。第二次它抱怨错误解析的标记,并且所使用的错误报告函数似乎是在调用 期间从生成的解析器内的 goto 语句迷宫内的某个地方调用的yyparse(),此时我不再明白发生了什么。
原始程序本身似乎只是被设计为预先获取所有输入然后退出,因此它并没有给我留下太多关于我丢失的内容的线索。抛开这个并不完全奇怪的想法,一些旧的状态被保留在该计划的其余部分的其他地方,我的主要问题是: