File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ func (w *websocketConnection) readWebsocketMessage() ([]byte, error) {
157
157
// close the current websocket connection
158
158
func (w * websocketConnection ) close () {
159
159
w .shutdownOnce .Do (func () {
160
- if w .isConnectionClosed {
160
+ if w .isConnClosed () {
161
161
return
162
162
}
163
163
@@ -193,13 +193,17 @@ func (w *websocketConnection) InitDataProcessing(dataProcessing ShipDataProcessi
193
193
194
194
// write a message to the websocket connection
195
195
func (w * websocketConnection ) WriteMessageToDataConnection (message []byte ) error {
196
- if w .conn == nil || w . shipWriteChannel == nil || w . isConnClosed () {
197
- return errors .New ("connection is not initialized " )
196
+ if w .isConnClosed () {
197
+ return errors .New ("connection is closed " )
198
198
}
199
199
200
200
w .mux .Lock ()
201
201
defer w .mux .Unlock ()
202
202
203
+ if w .conn == nil || w .shipWriteChannel == nil {
204
+ return errors .New ("connection is closed" )
205
+ }
206
+
203
207
w .shipWriteChannel <- message
204
208
return nil
205
209
}
You can’t perform that action at this time.
0 commit comments