try fixing race
This commit is contained in:
parent
29e6d12967
commit
1a18d20a1a
@ -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
|
||||||
|
Reference in New Issue
Block a user