Lines 20-26
Link Here
|
20 |
You should have received a copy of the GNU General Public License |
20 |
You should have received a copy of the GNU General Public License |
21 |
along with this program; if not, write to the Free Software |
21 |
along with this program; if not, write to the Free Software |
22 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
|
23 |
|
24 |
*************************************************************************** |
24 |
*************************************************************************** |
25 |
|
25 |
|
26 |
*/ |
26 |
*/ |
Lines 40-45
Link Here
|
40 |
#include <stdlib.h> |
40 |
#include <stdlib.h> |
41 |
#include <fstream> |
41 |
#include <fstream> |
42 |
#include "tMath.h" |
42 |
#include "tMath.h" |
|
|
43 |
#include <string.h> |
43 |
|
44 |
|
44 |
#ifndef WIN32 |
45 |
#ifndef WIN32 |
45 |
#include <netinet/in.h> |
46 |
#include <netinet/in.h> |
Lines 600-606
Link Here
|
600 |
if (message->Descriptor()!=s_Acknowledge.ID()) |
601 |
if (message->Descriptor()!=s_Acknowledge.ID()) |
601 |
sn_Connections[receiver].ackPending++; |
602 |
sn_Connections[receiver].ackPending++; |
602 |
else |
603 |
else |
603 |
tASSERT(false); |
604 |
tERR_ERROR("Should not wait for ack of an ack message itself."); |
|
|
605 |
|
604 |
// sn_ackAckPending[receiver]++; |
606 |
// sn_ackAckPending[receiver]++; |
605 |
#ifdef NET_DEBUG |
607 |
#ifdef NET_DEBUG |
606 |
acks++; |
608 |
acks++; |
Lines 646-652
Link Here
|
646 |
sn_Connections[receiver].ReliableMessageSent(); |
648 |
sn_Connections[receiver].ReliableMessageSent(); |
647 |
} |
649 |
} |
648 |
else |
650 |
else |
649 |
tASSERT(false); |
651 |
{ |
|
|
652 |
tERR_ERROR( "No message." ); |
653 |
} |
650 |
// sn_ackAckPending[receiver]--; |
654 |
// sn_ackAckPending[receiver]--; |
651 |
|
655 |
|
652 |
sn_pendingAcks.Remove(this,id); |
656 |
sn_pendingAcks.Remove(this,id); |
Lines 1146-1152
Link Here
|
1146 |
Read((unsigned short &)vorkomma); |
1150 |
Read((unsigned short &)vorkomma); |
1147 |
Read(nachkomma); |
1151 |
Read(nachkomma); |
1148 |
x=vorkomma+nachkomma/60000.0; |
1152 |
x=vorkomma+nachkomma/60000.0; |
1149 |
|
1153 |
|
1150 |
Read(((unsigned short *)&x)[0]); |
1154 |
Read(((unsigned short *)&x)[0]); |
1151 |
Read(((unsigned short *)&x)[1]); |
1155 |
Read(((unsigned short *)&x)[1]); |
1152 |
*/ |
1156 |
*/ |
Lines 1322-1328
Link Here
|
1322 |
lo->Send(0); |
1326 |
lo->Send(0); |
1323 |
|
1327 |
|
1324 |
sn_Sync(10); |
1328 |
sn_Sync(10); |
1325 |
|
1329 |
|
1326 |
(new nMessage(login))->Send(0); |
1330 |
(new nMessage(login))->Send(0); |
1327 |
*/ |
1331 |
*/ |
1328 |
} |
1332 |
} |
Lines 1891-1897
Link Here
|
1891 |
return; |
1895 |
return; |
1892 |
} |
1896 |
} |
1893 |
|
1897 |
|
1894 |
#ifdef DEBUG |
1898 |
#ifdef DEBUG |
1895 |
/* |
1899 |
/* |
1896 |
if (descriptor>1) |
1900 |
if (descriptor>1) |
1897 |
con << "SMT " << descriptor << "\n"; |
1901 |
con << "SMT " << descriptor << "\n"; |
Lines 1930-1952
Link Here
|
1930 |
/* |
1934 |
/* |
1931 |
if (sn_Connections[].rate_control[peer]>0) |
1935 |
if (sn_Connections[].rate_control[peer]>0) |
1932 |
send_collected(peer); |
1936 |
send_collected(peer); |
1933 |
|
1937 |
|
1934 |
unsigned short *b=new (unsigned short)[data.Len()+3]; |
1938 |
unsigned short *b=new (unsigned short)[data.Len()+3]; |
1935 |
|
1939 |
|
1936 |
b[0]=htons(descriptor); |
1940 |
b[0]=htons(descriptor); |
1937 |
b[1]=htons(messageID); |
1941 |
b[1]=htons(messageID); |
1938 |
b[2]=htons(data.Len()); |
1942 |
b[2]=htons(data.Len()); |
1939 |
int len=data.Len(); |
1943 |
int len=data.Len(); |
1940 |
for(int i=0;i<len;i++) |
1944 |
for(int i=0;i<len;i++) |
1941 |
b[3+i]=htons(data(i)); |
1945 |
b[3+i]=htons(data(i)); |
1942 |
|
1946 |
|
1943 |
|
1947 |
|
1944 |
ANET_Write(sn_Connections[].socket[peer],(int8 *)b, |
1948 |
ANET_Write(sn_Connections[].socket[peer],(int8 *)b, |
1945 |
2*(data.Len()+3),&peers[peer]); |
1949 |
2*(data.Len()+3),&peers[peer]); |
1946 |
|
1950 |
|
1947 |
//std::cerr << "Sent " << 2*len+6 << " bytes.\n"; |
1951 |
//std::cerr << "Sent " << 2*len+6 << " bytes.\n"; |
1948 |
sn_Connections[].rate_control[peer]-=2*(len+3)+OVERHEAD; |
1952 |
sn_Connections[].rate_control[peer]-=2*(len+3)+OVERHEAD; |
1949 |
|
1953 |
|
1950 |
delete b; |
1954 |
delete b; |
1951 |
*/ |
1955 |
*/ |
1952 |
|
1956 |
|
Lines 2023-2030
Link Here
|
2023 |
// the growing buffer we read messages into |
2027 |
// the growing buffer we read messages into |
2024 |
const int serverMaxAcceptedSize=2000; |
2028 |
const int serverMaxAcceptedSize=2000; |
2025 |
static tArray< unsigned short > storage(2000); |
2029 |
static tArray< unsigned short > storage(2000); |
2026 |
int maxrec = storage.Len(); |
2030 |
int maxrec = 0; maxrec = storage.Len(); |
2027 |
unsigned short * buff = &storage[0]; |
2031 |
unsigned short * buff = 0; buff = &storage[0]; |
2028 |
|
2032 |
|
2029 |
// short buff[maxrec]; |
2033 |
// short buff[maxrec]; |
2030 |
if (sn_Connections[peer].socket){ |
2034 |
if (sn_Connections[peer].socket){ |
Lines 2380-2386
Link Here
|
2380 |
sn_Listen( net_hostport, tString( "ANY" ) ) || // second try: bind to generic IP |
2384 |
sn_Listen( net_hostport, tString( "ANY" ) ) || // second try: bind to generic IP |
2381 |
sn_Listen( net_hostport, tString( "ALL" ) ); // last try: bind to all available IPs |
2385 |
sn_Listen( net_hostport, tString( "ALL" ) ); // last try: bind to all available IPs |
2382 |
|
2386 |
|
2383 |
#ifdef DEDICATED |
2387 |
#ifdef DEDICATED |
2384 |
// save host port that worked, otherwise it may change from the port sent to the master server |
2388 |
// save host port that worked, otherwise it may change from the port sent to the master server |
2385 |
sn_serverPort = net_hostport; |
2389 |
sn_serverPort = net_hostport; |
2386 |
#endif |
2390 |
#endif |