Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for WithWriteDeadline (0.18 sec)

  1. internal/deadlineconn/deadlineconn.go

    // WithReadDeadline sets a new read side net.Conn deadline.
    func (c *DeadlineConn) WithReadDeadline(d time.Duration) *DeadlineConn {
    	c.readDeadline = d
    	return c
    }
    
    // WithWriteDeadline sets a new write side net.Conn deadline.
    func (c *DeadlineConn) WithWriteDeadline(d time.Duration) *DeadlineConn {
    	c.writeDeadline = d
    	return c
    }
    
    // New - creates a new connection object wrapping net.Conn with deadlines.
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Nov 05 18:09:21 GMT 2022
    - 2.3K bytes
    - Viewed (0)
  2. internal/deadlineconn/deadlineconn_test.go

    		if terr != nil {
    			t.Errorf("failed to accept new connection. %v", terr)
    			return
    		}
    		deadlineconn := New(tcpConn)
    		deadlineconn.WithReadDeadline(time.Second)
    		deadlineconn.WithWriteDeadline(time.Second)
    		defer deadlineconn.Close()
    
    		// Read a line
    		b := make([]byte, 12)
    		_, terr = deadlineconn.Read(b)
    		if terr != nil {
    			t.Errorf("failed to read from client. %v", terr)
    			return
    		}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Nov 05 18:09:21 GMT 2022
    - 3K bytes
    - Viewed (0)
  3. internal/http/listener.go

    	select {
    	case result, ok := <-listener.acceptCh:
    		if ok {
    			return deadlineconn.New(result.conn).
    				WithReadDeadline(listener.opts.ClientReadTimeout).
    				WithWriteDeadline(listener.opts.ClientWriteTimeout), result.err
    		}
    	case <-listener.ctx.Done():
    	}
    	return nil, syscall.EINVAL
    }
    
    // Close - closes underneath all TCP listeners.
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Mar 01 16:00:42 GMT 2024
    - 5.8K bytes
    - Viewed (0)
Back to top