Commit ddc2da5e authored by Ivan Krasin's avatar Ivan Krasin

Added handling EOF

parent 90006e7b
...@@ -80,6 +80,10 @@ func (m *MountPoint) loop() { ...@@ -80,6 +80,10 @@ func (m *MountPoint) loop() {
if err != nil { if err != nil {
errors <- err errors <- err
} }
if err == os.EOF {
break
}
go m.handle(buf[0:n], toW, errors) go m.handle(buf[0:n], toW, errors)
} }
} }
...@@ -88,6 +92,9 @@ func (m *MountPoint) handle(in []byte, toW chan [][]byte, errors chan os.Error) ...@@ -88,6 +92,9 @@ func (m *MountPoint) handle(in []byte, toW chan [][]byte, errors chan os.Error)
r := bytes.NewBuffer(in) r := bytes.NewBuffer(in)
var h InHeader var h InHeader
err := binary.Read(r, binary.LittleEndian, &h) err := binary.Read(r, binary.LittleEndian, &h)
if err == os.EOF {
err = os.NewError(fmt.Sprintf("MountPoint, handle: can't read a header, in: %v", in))
}
if err != nil { if err != nil {
errors <- err errors <- err
return return
...@@ -111,6 +118,9 @@ func (m *MountPoint) writer(f *os.File, in chan [][]byte, errors chan os.Error) ...@@ -111,6 +118,9 @@ func (m *MountPoint) writer(f *os.File, in chan [][]byte, errors chan os.Error)
func (m *MountPoint) errorHandler(errors chan os.Error) { func (m *MountPoint) errorHandler(errors chan os.Error) {
for err := range errors { for err := range errors {
log.Stderr("MountPoint.errorHandler: ", err) log.Stderr("MountPoint.errorHandler: ", err)
if err == os.EOF {
break
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment