Cube  Diff

Differences From Artifact [6f1a324e2b]:

To Artifact [d4363a4bcc]:


125
126
127
128
129
130
131
132

133
134
135

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
125
126
127
128
129
130
131

132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157







-
+


-
+














-
+







	conoutf(@"attempting to connect to %@", servername);
	ENetAddress address = { ENET_HOST_ANY, CUBE_SERVER_PORT };
	if (enet_address_set_host(&address, servername.UTF8String) < 0) {
		conoutf(@"could not resolve server %@", servername);
		return;
	}

	clienthost = enet_host_create(NULL, 1, rate, rate);
	clienthost = enet_host_create(NULL, 1, 0, rate, rate);

	if (clienthost) {
		enet_host_connect(clienthost, &address, 1);
		enet_host_connect(clienthost, &address, 0, 1);
		enet_host_flush(clienthost);
		connecting = lastmillis;
		connattempts = 0;
	} else {
		conoutf(@"could not connect to server");
		disconnect(false, false);
	}
}

void
disconnect(bool onlyclean, bool async)
{
	if (clienthost) {
		if (!connecting && !disconnecting) {
			enet_peer_disconnect(clienthost->peers);
			enet_peer_disconnect(clienthost->peers, 0);
			enet_host_flush(clienthost);
			disconnecting = lastmillis;
		}
		if (clienthost->peers->state != ENET_PEER_STATE_DISCONNECTED) {
			if (async)
				return;
			enet_peer_reset(clienthost->peers);