@@ -109,9 +109,9 @@ func (h *ihash) Close() error {
109109
110110func (h * ihash ) ReadFrom (r io.Reader ) (int64 , error ) {
111111 if f , ok := r .(* os.File ); ok {
112- if w , err , handled := h .sendfile (f , - 1 ); handled {
113- return w , err
114- }
112+ // if w, err, handled := h.sendfile(f, -1); handled {
113+ // return w, err
114+ // }
115115 if w , err , handled := h .splice (f , - 1 ); handled {
116116 return w , err
117117 }
@@ -124,9 +124,9 @@ func (h *ihash) ReadFrom(r io.Reader) (int64, error) {
124124
125125func (h * ihash ) readFromLimitedReader (lr * io.LimitedReader ) (int64 , error ) {
126126 if f , ok := lr .R .(* os.File ); ok {
127- if w , err , handled := h .sendfile (f , lr .N ); handled {
128- return w , err
129- }
127+ // if w, err, handled := h.sendfile(f, lr.N); handled {
128+ // return w, err
129+ // }
130130 if w , err , handled := h .splice (f , lr .N ); handled {
131131 return w , err
132132 }
@@ -224,24 +224,13 @@ func (h *ihash) sendfile(f *os.File, remain int64) (written int64, err error, ha
224224
225225// Write writes data to an AF_ALG socket, but instructs the kernel
226226// not to finalize the hash.
227- func (h * ihash ) Write (b []byte ) (written int , err error ) {
228- for {
229- n , err := h .pipes [1 ].Vmsplice (b , 0 )
230- written += n
231- if err != nil {
232- break
233- }
234- _ , err = h .pipes [0 ].Splice (h .s .FD (), n , unix .SPLICE_F_MOVE | unix .SPLICE_F_MORE )
235- if err != nil {
236- break
237- }
238- if n >= len (b ) {
239- break
240- }
241- b = b [n :]
227+ func (h * ihash ) Write (b []byte ) (int , error ) {
228+ n , err := h .pipes [1 ].Vmsplice (b , 0 )
229+ if err != nil {
230+ return n , err
242231 }
243-
244- return
232+ _ , err = h . pipes [ 0 ]. Splice ( h . s . FD (), n , unix . SPLICE_F_MOVE | unix . SPLICE_F_MORE )
233+ return n , err
245234}
246235
247236// Sum reads data from an AF_ALG socket, and appends it to the input
0 commit comments