forked from Silverfish/proton-bridge
test: fix panic on concurrent map write
This commit is contained in:
@ -71,10 +71,16 @@ func (ctx *TestContext) withIMAPServer() {
|
||||
|
||||
// SetIMAPLastResponse sets the last IMAP response that was received.
|
||||
func (ctx *TestContext) SetIMAPLastResponse(handle string, resp *mocks.IMAPResponse) {
|
||||
ctx.imapResponseLocker.Lock()
|
||||
defer ctx.imapResponseLocker.Unlock()
|
||||
|
||||
ctx.imapLastResponses[handle] = resp
|
||||
}
|
||||
|
||||
// GetIMAPLastResponse returns the last IMAP response that was received.
|
||||
func (ctx *TestContext) GetIMAPLastResponse(handle string) *mocks.IMAPResponse {
|
||||
ctx.imapResponseLocker.Lock()
|
||||
defer ctx.imapResponseLocker.Unlock()
|
||||
|
||||
return ctx.imapLastResponses[handle]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user