Merge pull request 'Move chunk respones into goroutine to not block the listen() thread' (#390) from filesharing-bugs into master
Reviewed-on: #390 Reviewed-by: erinn <erinn@openprivacy.ca>
This commit is contained in:
commit
eefc39272a
|
@ -561,11 +561,14 @@ func (e *engine) handlePeerMessage(hostname string, eventID string, context stri
|
||||||
e.eventManager.Publish(event.NewEvent(event.ManifestReceived, map[event.Field]string{event.Handle: hostname, event.FileKey: fileKey, event.SerializedManifest: manifest}))
|
e.eventManager.Publish(event.NewEvent(event.ManifestReceived, map[event.Field]string{event.Handle: hostname, event.FileKey: fileKey, event.SerializedManifest: manifest}))
|
||||||
}
|
}
|
||||||
} else if context == event.ContextRequestFile {
|
} else if context == event.ContextRequestFile {
|
||||||
for _, message := range e.filesharingSubSystem.ProcessChunkRequest(eventID, message) {
|
chunks := e.filesharingSubSystem.ProcessChunkRequest(eventID, message)
|
||||||
if err := e.sendPeerMessage(hostname, message); err != nil {
|
go func() {
|
||||||
e.eventManager.Publish(event.NewEvent(event.SendMessageToPeerError, map[event.Field]string{event.RemotePeer: hostname, event.EventID: eventID, event.Error: err.Error()}))
|
for _, message := range chunks {
|
||||||
|
if err := e.sendPeerMessage(hostname, message); err != nil {
|
||||||
|
e.eventManager.Publish(event.NewEvent(event.SendMessageToPeerError, map[event.Field]string{event.RemotePeer: hostname, event.EventID: eventID, event.Error: err.Error()}))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}()
|
||||||
} else if context == event.ContextSendFile {
|
} else if context == event.ContextSendFile {
|
||||||
fileKey, progress, totalChunks, _, title := e.filesharingSubSystem.ProcessChunk(eventID, message)
|
fileKey, progress, totalChunks, _, title := e.filesharingSubSystem.ProcessChunk(eventID, message)
|
||||||
if len(fileKey) != 0 {
|
if len(fileKey) != 0 {
|
||||||
|
|
Loading…
Reference in New Issue