Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for CloseWriter (0.32 sec)

  1. pkg/hbone/util.go

    			// read is already closed - we need to close out
    			_ = closeWriter(dst)
    			return
    		}
    	}
    }
    
    // CloseWriter is one of possible interfaces implemented by Out to send a FIN, without closing
    // the input. Some writers only do this when Close is called.
    type CloseWriter interface {
    	CloseWrite() error
    }
    
    func closeWriter(dst io.Writer) error {
    	if cw, ok := dst.(CloseWriter); ok {
    		return cw.CloseWrite()
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  2. internal/ringbuffer/README.md

    `TryRead` and `TryWrite` are still available for non-blocking reads and writes.
    
    To signify the end of the stream, close the ring buffer from the writer side with `rb.CloseWriter()`
    
    Either side can use `rb.CloseWithError(err error)` to signal an error and close the ring buffer. 
    Any reads or writes will return the error on next call.
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  3. internal/ringbuffer/ring_buffer.go

    // and always returns nil.
    func (r *RingBuffer) CloseWithError(err error) {
    	if err == nil {
    		err = io.EOF
    	}
    	r.setErr(err, false)
    }
    
    // CloseWriter closes the writer.
    // Reads will return any remaining bytes and io.EOF.
    func (r *RingBuffer) CloseWriter() {
    	r.setErr(io.EOF, false)
    }
    
    // Flush waits for the buffer to be empty and fully read.
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  4. internal/ringbuffer/ring_buffer_test.go

    			}
    			if doSleep && writeRng.Intn(10) == 0 {
    				time.Sleep(time.Duration(writeRng.Intn(maxSleep)))
    			}
    		}
    		if err := rb.Flush(); err != nil {
    			t.Fatalf("flush failed: %v", err)
    		}
    		rb.CloseWriter()
    	}
    	wg.Wait()
    	if !errors.Is(readErr, io.EOF) {
    		t.Fatalf("expect io.EOF but got %v", readErr)
    	}
    	if readBytes != wroteBytes {
    		a, b := readBuf.Bytes(), wroteBuf.Bytes()
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 26.8K bytes
    - Viewed (0)
  5. src/net/http/server.go

    //
    // TODO(bcmills): This should arguably be a server configuration parameter,
    // not a hard-coded value.
    var rstAvoidanceDelay = 500 * time.Millisecond
    
    type closeWriter interface {
    	CloseWrite() error
    }
    
    var _ closeWriter = (*net.TCPConn)(nil)
    
    // closeWriteAndWait flushes any outstanding data and sends a FIN packet (if
    // client is connected via TCP), signaling that we're done. We then
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 17:57:01 UTC 2024
    - 123.4K bytes
    - Viewed (0)
Back to top