File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/main/java/com/github/theholywaffle/teamspeak3 Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 35
35
36
36
import java .io .IOException ;
37
37
import java .net .Socket ;
38
+ import java .util .ArrayList ;
39
+ import java .util .Collection ;
38
40
import java .util .concurrent .ArrayBlockingQueue ;
39
41
import java .util .concurrent .BlockingQueue ;
40
42
import java .util .concurrent .LinkedBlockingQueue ;
@@ -120,11 +122,12 @@ public void disconnect() {
120
122
}
121
123
122
124
void failRemainingCommands () {
123
- for (ResponseBuilder toReceive : receiveQueue ) {
124
- toReceive .getCommand ().getFuture ().fail (new TS3QueryShutDownException ());
125
- }
126
- for (Command toSend : sendQueue ) {
127
- toSend .getFuture ().fail (new TS3QueryShutDownException ());
125
+ Collection <Command > commands = new ArrayList <>(receiveQueue .size () + sendQueue .size () + 1 );
126
+ socketReader .drainCommandsTo (commands );
127
+ socketWriter .drainCommandsTo (commands );
128
+
129
+ for (Command command : commands ) {
130
+ command .getFuture ().fail (new TS3QueryShutDownException ());
128
131
}
129
132
}
130
133
You can’t perform that action at this time.
0 commit comments