summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/NetworkWriterThread.java
blob: 68d84deb8aa3c2c4d587949bc806ee90d66d341f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package net.minecraft.server;

import java.io.IOException;

class NetworkWriterThread extends Thread {

    final NetworkManager a;

    NetworkWriterThread(NetworkManager networkmanager, String s) {
        super(s);
        this.a = networkmanager;
    }

    public void run() {
        NetworkManager.b.getAndIncrement();

        try {
            while (NetworkManager.a(this.a)) {
                boolean flag;

                for (flag = false; NetworkManager.d(this.a); flag = true) {
                    ;
                }

                try {
                    if (flag && NetworkManager.e(this.a) != null) {
                        NetworkManager.e(this.a).flush();
                    }
                } catch (IOException ioexception) {
                    if (!NetworkManager.f(this.a)) {
                        NetworkManager.a(this.a, (Exception) ioexception);
                    }

                    // ioexception.printStackTrace(); // CraftBukkit - Don't spam console on unexpected disconnect
                }

                try {
                    sleep(2L);
                } catch (InterruptedException interruptedexception) {
                    ;
                }
            }
        } finally {
            NetworkManager.b.getAndDecrement();
        }
    }
}