File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
htsp/src/main/java/ie/macinnes/htsp Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -328,15 +328,16 @@ protected void close(int endState) {
328328 public void sendMessage (HtspMessage htspMessage ) throws ConnectionException {
329329 Log .d (TAG , "Sending HtspMessage: " + htspMessage .toString ());
330330
331- if (isClosed ()) {
332- Log .w (TAG , "Failed to send message, connection closed" );
333- throw new ConnectionException ("Failed to send message, connection closed" );
334- }
335-
336- mMessageQueue .add (htspMessage );
337331
338332 mLock .lock ();
339333 try {
334+ if (isClosed ()) {
335+ Log .w (TAG , "Failed to send message, connection closed" );
336+ throw new ConnectionException ("Failed to send message, connection closed" );
337+ }
338+
339+ mMessageQueue .add (htspMessage );
340+
340341 mSocketChannel .register (mSelector , SelectionKey .OP_WRITE | SelectionKey .OP_READ | SelectionKey .OP_CONNECT );
341342 mSelector .wakeup ();
342343 } catch (ClosedChannelException e ) {
You can’t perform that action at this time.
0 commit comments