(b []byte)
| 55 | } |
| 56 | |
| 57 | func (c *connPipe) Write(b []byte) (int, error) { |
| 58 | // The nettest/ConcurrentMethods test spawns a bunch of goroutines that do |
| 59 | // random stuff on the connection, if a Read or Write was issued before a |
| 60 | // deadline was set then it could cancel an inflight request to kafka, |
| 61 | // resulting in the connection being closed. |
| 62 | // To prevent this from happening we wait a little while to give the other |
| 63 | // goroutines a chance to start and set the deadline. |
| 64 | time.Sleep(time.Millisecond) |
| 65 | |
| 66 | // The nettest code only sets deadlines when it expects the write to time |
| 67 | // out. The broker connection is alive and able to accept data, so we need |
| 68 | // to simulate the timeout in order to get the tests to pass. |
| 69 | if t := c.wconn.writeDeadline(); !t.IsZero() { |
| 70 | return 0, &timeout{} |
| 71 | } |
| 72 | |
| 73 | return c.wconn.Write(b) |
| 74 | } |
| 75 | |
| 76 | func (c *connPipe) LocalAddr() net.Addr { |
| 77 | return c.rconn.LocalAddr() |
no test coverage detected