Archived
1
0

try fixing race

This commit is contained in:
Jeff 2019-01-28 12:03:52 -05:00
parent 29e6d12967
commit 1a18d20a1a

View File

@ -138,9 +138,9 @@ func createArticleStore(config map[string]string, thumbConfig *ThumbnailConfig,
compression: config["compression"] == "1", compression: config["compression"] == "1",
spamd: spamd, spamd: spamd,
spamdir: filepath.Join(config["store_dir"], "spam"), spamdir: filepath.Join(config["store_dir"], "spam"),
hamdir: filepath.Join(config["store_dir"], "ham"), hamdir: filepath.Join(config["store_dir"], "ham"),
thumbnails: thumbConfig, thumbnails: thumbConfig,
} }
store.Init() store.Init()
return store return store
@ -591,21 +591,14 @@ func (self *articleStore) GetMessage(msgid string) (nntp NNTPMessage) {
br := bufio.NewReader(r) br := bufio.NewReader(r)
msg, err := readMIMEHeader(br) msg, err := readMIMEHeader(br)
if err == nil { if err == nil {
chnl := make(chan NNTPMessage)
hdr := textproto.MIMEHeader(msg.Header) hdr := textproto.MIMEHeader(msg.Header)
err = read_message_body(msg.Body, hdr, nil, nil, true, func(n NNTPMessage) { err = read_message_body(msg.Body, hdr, nil, nil, true, func(n NNTPMessage) {
c := chnl
if n != nil { if n != nil {
// inject pubkey for mod // inject pubkey for mod
n.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519")) n.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519"))
c <- n
} }
nntp = n
}) })
if err == nil {
nntp = <-chnl
} else {
log.Println("GetMessage() failed to load", msgid, err)
}
} }
} }
return return