()
| 44 | } |
| 45 | |
| 46 | func (t *tcpTransport) Write() bool { |
| 47 | tcp_conn := t.conn |
| 48 | write_queue := t.write_queue |
| 49 | msg_list := make([]interface{}, 16) |
| 50 | for { |
| 51 | c := write_queue.Get(msg_list, 16) |
| 52 | for i := uint32(0); i < c; i++ { |
| 53 | write_msg := msg_list[i].(*WriteWrapper) |
| 54 | if write_msg == nil { |
| 55 | goto write_close |
| 56 | } |
| 57 | if t.WriteMsgPacket(tcp_conn, write_msg) == false { |
| 58 | goto write_close |
| 59 | } |
| 60 | msg_list[i] = nil |
| 61 | write_msg.reset() |
| 62 | write_pool.Put(write_msg) |
| 63 | } |
| 64 | } |
| 65 | write_close: |
| 66 | buf := t.write_buf |
| 67 | t.write_buf = nil |
| 68 | buffer_pool.Put(buf) |
| 69 | return false |
| 70 | } |
| 71 | |
| 72 | func (t *tcpTransport) WriteMsgPacket(conn net.Conn, msg *WriteWrapper) bool { |
| 73 | switch msg.msg_type { |
no test coverage detected