File tree Expand file tree Collapse file tree
src/main/java/com/github/theholywaffle/teamspeak3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535
3636import java .io .IOException ;
3737import java .net .Socket ;
38+ import java .util .ArrayList ;
39+ import java .util .Collection ;
3840import java .util .concurrent .ArrayBlockingQueue ;
3941import java .util .concurrent .BlockingQueue ;
4042import java .util .concurrent .LinkedBlockingQueue ;
@@ -120,11 +122,12 @@ public void disconnect() {
120122 }
121123
122124 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 ());
128131 }
129132 }
130133
You can’t perform that action at this time.
0 commit comments