]> go.fuhry.dev Git - fsnotify.git/commitdiff
Handle ERROR_MORE_DATA on Windows
authorJohn C Barstow <jbowtie@amathaine.com>
Mon, 10 Jun 2013 03:18:34 +0000 (15:18 +1200)
committerJohn C Barstow <jbowtie@amathaine.com>
Mon, 10 Jun 2013 03:18:34 +0000 (15:18 +1200)
See issue #49 for background and discussion

fsnotify_windows.go

index 8245130992db7aa9fa9f11f706d7fc51cd27b647..fd70a2b965eb53ebb108c43433b74b40b5b5a1d3 100644 (file)
@@ -41,6 +41,10 @@ const (
        sys_FS_Q_OVERFLOW = 0x4000
 )
 
+const (
+       ERROR_MORE_DATA syscall.Errno = 234
+)
+
 // Event is the type of the notification messages
 // received on the watcher's Event channel.
 type FileEvent struct {
@@ -438,6 +442,16 @@ func (w *Watcher) readEvents() {
                }
 
                switch e {
+               case ERROR_MORE_DATA:
+                       if watch == nil {
+                               w.Error <- errors.New("ERROR_MORE_DATA has unexpectedly null lpOverlapped buffer")
+                       } else {
+                               //The i/o succeeded but buffer is full
+                               //in theory we should be building up a full packet
+                               //in practice we can get away with just carrying on
+                               //should be len(watch.buf) possibly?
+                               n = 4096
+                       }
                case syscall.ERROR_ACCESS_DENIED:
                        // Watched directory was probably removed
                        w.sendEvent(watch.path, watch.mask&sys_FS_DELETE_SELF)