mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Add comments (checked that no other host socket numbers leak to the game)
This commit is contained in:
@@ -1813,6 +1813,7 @@ int getLocalIp(sockaddr_in* SocketAddress) {
|
||||
}
|
||||
|
||||
#else // Alternative way
|
||||
// Socket doesn't "leak" to the game.
|
||||
int sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock != SOCKET_ERROR) {
|
||||
const char* kGoogleDnsIp = "8.8.8.8"; // Needs to be an IP string so it can be resolved as fast as possible to IP, doesn't need to be reachable
|
||||
|
||||
@@ -1379,6 +1379,7 @@ int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 flag) {
|
||||
// Valid MAC supplied. FIXME: MAC only valid after successful attempt to Create/Connect/Join a Group? (ie. adhocctlCurrentMode != ADHOCCTL_MODE_NONE)
|
||||
if ((adhocctlCurrentMode != ADHOCCTL_MODE_NONE) && isLocalMAC(saddr)) {
|
||||
// Create Internet UDP Socket
|
||||
// Socket is remapped through adhocSockets
|
||||
int usocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
// Valid Socket produced
|
||||
if (usocket != INVALID_SOCKET) {
|
||||
@@ -3257,6 +3258,7 @@ int RecreatePtpSocket(int ptpId) {
|
||||
closesocket(sock->data.ptp.id);
|
||||
|
||||
// Create a new socket
|
||||
// Socket is remapped through adhocSockets
|
||||
int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
// Valid Socket produced
|
||||
@@ -3375,7 +3377,8 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac,
|
||||
|
||||
// Valid Arguments
|
||||
if (bufsize > 0 && rexmt_int > 0 && rexmt_cnt > 0) {
|
||||
// Create Infrastructure Socket
|
||||
// Create Infrastructure Socket (?)
|
||||
// Socket is remapped through adhocSockets
|
||||
int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
// Valid Socket produced
|
||||
@@ -3977,7 +3980,8 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int
|
||||
// Valid Arguments
|
||||
if (bufsize > 0 && rexmt_int > 0 && rexmt_cnt > 0 && backlog > 0)
|
||||
{
|
||||
// Create Infrastructure Socket
|
||||
// Create Infrastructure Socket (?)
|
||||
// Socket is remapped through adhocSockets
|
||||
int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
// Valid Socket produced
|
||||
|
||||
@@ -321,6 +321,7 @@ int sceNetInetPoll(u32 fdsPtr, u32 nfds, int timeout) { // timeout in milisecond
|
||||
FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds);
|
||||
for (int i = 0; i < (s32)nfds; i++) {
|
||||
if (fdarray[i].fd < 0) {
|
||||
// In Unix, this is OK and means it the fd should be ignored, except fdarray[i].revents should be zeroed.
|
||||
inetLastErrno = EINVAL;
|
||||
return hleLogError(Log::sceNet, -1, "invalid socket id");
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@ typedef struct SceNetInetLinger {
|
||||
// Polling Event Field
|
||||
typedef struct SceNetInetPollfd { //similar format to pollfd in 32bit (pollfd in 64bit have different size)
|
||||
s32_le fd;
|
||||
s16_le events;
|
||||
s16_le revents;
|
||||
s16_le events; // requested events
|
||||
s16_le revents; // returned events
|
||||
} PACK SceNetInetPollfd;
|
||||
|
||||
// TCP & UDP Socket Union (Internal use only)
|
||||
|
||||
Reference in New Issue
Block a user