(mgr *manager.Manager)
| 7 | ) |
| 8 | |
| 9 | func DispatchFileMess(mgr *manager.Manager) { |
| 10 | for { |
| 11 | message := <-mgr.FileManager.FileMessChan |
| 12 | |
| 13 | switch mess := message.(type) { |
| 14 | case *protocol.FileStatReq: |
| 15 | mgr.FileManager.File.FileName = mess.Filename |
| 16 | mgr.FileManager.File.SliceNum = mess.SliceNum |
| 17 | err := mgr.FileManager.File.CheckFileStat(protocol.TEMP_ROUTE, protocol.ADMIN_UUID, share.AGENT) |
| 18 | if err == nil { |
| 19 | go mgr.FileManager.File.Receive(protocol.TEMP_ROUTE, protocol.ADMIN_UUID, share.AGENT) |
| 20 | } |
| 21 | case *protocol.FileStatRes: |
| 22 | if mess.OK == 1 { |
| 23 | go mgr.FileManager.File.Upload(protocol.TEMP_ROUTE, protocol.ADMIN_UUID, share.AGENT) |
| 24 | } else { |
| 25 | mgr.FileManager.File.Handler.Close() |
| 26 | } |
| 27 | case *protocol.FileDownReq: |
| 28 | mgr.FileManager.File.FilePath = mess.FilePath |
| 29 | mgr.FileManager.File.FileName = mess.Filename |
| 30 | go mgr.FileManager.File.SendFileStat(protocol.TEMP_ROUTE, protocol.ADMIN_UUID, share.AGENT) |
| 31 | case *protocol.FileData: |
| 32 | mgr.FileManager.File.DataChan <- mess.Data |
| 33 | case *protocol.FileErr: |
| 34 | mgr.FileManager.File.ErrChan <- true |
| 35 | } |
| 36 | } |
| 37 | } |
no test coverage detected