Commits

Torr_Samaho  committed 4740916

[Koromix] Fixed problems with the LAN broadcast under Linux.

  • Participants
  • Parent commits 93f81bd

Comments (0)

Files changed (5)

File docs/Skulltag Version History.txt

 -	- Fixed: Grenade explosion sound was not unlimited. [Dusk]
 -	- Fixed: Players could get medals from spawn telefrags. [Dusk]
 -	- Fixed: Accuracy/Precision medals are now properly given when using the Rocket Launcher, Grenade Launcher, or BFG10K. [MP2E, Torr Samaho]
+-	- Fixed problems with the LAN broadcast under Linux. [Koromix]
 !	- Changed F12 to allow spectators full spying, with the exception of during LMS if it's disabled. [Eruanna]
 !	- Changed F12 to allow full demo spying. [Eruanna]
 !	- Players aren't forced to spectate after a "changemap" map change on a server with a join password anymore. [Torr Samaho]

File masterserver/network.cpp

 {
 	int		iErrorCode;
 	struct sockaddr_in address;
-	bool	bBroadCast = true;
+
+	// setsockopt needs an int, bool won't work
+	int		enable = 1;
 
 	memset (&address, 0, sizeof(address));
 	address.sin_family = AF_INET;
 	address.sin_port = htons( usPort );
 
 	// Allow the network socket to broadcast.
-	setsockopt( Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&bBroadCast, sizeof( bBroadCast ));
+	setsockopt( Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&enable, sizeof( enable ));
 	if ( bReUse )
-		setsockopt( Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&bBroadCast, sizeof( bBroadCast ));
+		setsockopt( Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&enable, sizeof( enable ));
 
 	iErrorCode = bind( Socket, (sockaddr *)&address, sizeof( address ));
 	if ( iErrorCode == SOCKET_ERROR )

File src/network.cpp

 {
 	int		iErrorCode;
 	struct sockaddr_in address;
-	bool	bBroadCast = true;
+
+	// setsockopt needs an int, bool won't work
+	int		enable = 1;
 
 	memset (&address, 0, sizeof(address));
 	address.sin_family = AF_INET;
 	address.sin_port = htons( usPort );
 
 	// Allow the network socket to broadcast.
-	setsockopt( Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&bBroadCast, sizeof( bBroadCast ));
+	setsockopt( Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&enable, sizeof( enable ));
 	if ( bReUse )
-		setsockopt( Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&bBroadCast, sizeof( bBroadCast ));
+		setsockopt( Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&enable, sizeof( enable ));
 
 	iErrorCode = bind( Socket, (sockaddr *)&address, sizeof( address ));
 	if ( iErrorCode == SOCKET_ERROR )

File statsmaker/network.cpp

 {
 	int		iErrorCode;
 	struct sockaddr_in address;
-	bool	bBroadCast = true;
+
+	// setsockopt needs an int, bool won't work
+	int		enable = 1;
 
 	memset (&address, 0, sizeof(address));
 	address.sin_family = AF_INET;
 	address.sin_port = htons( usPort );
 
 	// Allow the network socket to broadcast.
-	setsockopt( Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&bBroadCast, sizeof( bBroadCast ));
+	setsockopt( Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&enable, sizeof( enable ));
 	if ( bReUse )
-		setsockopt( Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&bBroadCast, sizeof( bBroadCast ));
+		setsockopt( Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&enable, sizeof( enable ));
 
 	iErrorCode = bind( Socket, (sockaddr *)&address, sizeof( address ));
 	if ( iErrorCode == SOCKET_ERROR )

File upnpnat/upnpnat.cpp

 	struct timeval tv;
 	tv.tv_sec = 3;
 	tv.tv_usec = 0;
-	ret=setsockopt(tcp_socket_fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof ( tv ) ); 
+	ret=setsockopt(tcp_socket_fd, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof ( tv ) ); 
 
 	struct sockaddr_in r_address;
 
 	r_address.sin_port=htons(HTTPMU_HOST_PORT);
 	r_address.sin_addr.s_addr=inet_addr(HTTPMU_HOST_ADDRESS);
 
-	bool bOptVal = true;
-	int bOptLen = sizeof(bool);
-	int iOptLen = sizeof(int);
-
-	ret=setsockopt(udp_socket_fd, SOL_SOCKET, SO_BROADCAST, (char*)&bOptVal, bOptLen); 
+	int enable = 1;
+	ret=setsockopt(udp_socket_fd, SOL_SOCKET, SO_BROADCAST, (const char *)&enable, sizeof(enable)); 
 
 	ret=sendto(udp_socket_fd,send_buff.c_str(),send_buff.size(),0,(struct sockaddr*)&r_address,sizeof(struct sockaddr_in));