(conn net.Conn, serverImpl ServerImpl, debugStr string)
| 152 | } |
| 153 | |
| 154 | func SetupConnRpcClient(conn net.Conn, serverImpl ServerImpl, debugStr string) (*WshRpc, chan error, error) { |
| 155 | inputCh := make(chan baseds.RpcInputChType, DefaultInputChSize) |
| 156 | outputCh := make(chan []byte, DefaultOutputChSize) |
| 157 | writeErrCh := make(chan error, 1) |
| 158 | go func() { |
| 159 | defer func() { |
| 160 | panichandler.PanicHandler("SetupConnRpcClient:AdaptOutputChToStream", recover()) |
| 161 | }() |
| 162 | writeErr := AdaptOutputChToStream(outputCh, conn) |
| 163 | if writeErr != nil { |
| 164 | writeErrCh <- writeErr |
| 165 | close(writeErrCh) |
| 166 | } |
| 167 | }() |
| 168 | go func() { |
| 169 | defer func() { |
| 170 | panichandler.PanicHandler("SetupConnRpcClient:AdaptStreamToMsgCh", recover()) |
| 171 | }() |
| 172 | // when input is closed, close the connection |
| 173 | defer conn.Close() |
| 174 | AdaptStreamToMsgCh(conn, inputCh, nil) |
| 175 | }() |
| 176 | rtn := MakeWshRpcWithChannels(inputCh, outputCh, wshrpc.RpcContext{}, serverImpl, debugStr) |
| 177 | return rtn, writeErrCh, nil |
| 178 | } |
| 179 | |
| 180 | func tryTcpSocket(sockName string) (net.Conn, error) { |
| 181 | addr, err := net.ResolveTCPAddr("tcp", sockName) |
no test coverage detected