mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Change socket's MSS based on PSP_ADHOC_PTP_MSS
This commit is contained in:
parent
f30c61849b
commit
38d887ce88
@ -1918,6 +1918,11 @@ int setSockBufferSize(int sock, int opt, int size) { // opt = SO_RCVBUF/SO_SNDBU
|
||||
return setsockopt(sock, SOL_SOCKET, opt, (char *)&n, sizeof(n));
|
||||
}
|
||||
|
||||
int setSockMSS(int sock, int size) {
|
||||
int mss = size; // 1460;
|
||||
return setsockopt(sock, IPPROTO_TCP, TCP_MAXSEG, (char*)&mss, sizeof(mss));
|
||||
}
|
||||
|
||||
int setSockTimeout(int sock, int opt, unsigned long timeout_usec) { // opt = SO_SNDTIMEO/SO_RCVTIMEO
|
||||
if (timeout_usec > 0 && timeout_usec < minSocketTimeoutUS) timeout_usec = minSocketTimeoutUS; // Override timeout for high latency multiplayer
|
||||
#if defined(_WIN32)
|
||||
|
@ -1287,6 +1287,11 @@ int getSockBufferSize(int sock, int opt);
|
||||
*/
|
||||
int setSockBufferSize(int sock, int opt, int size);
|
||||
|
||||
/*
|
||||
* Set TCP Socket Maximum Segment Size (default is 1460 on 1500 MTU)
|
||||
*/
|
||||
int setSockMSS(int sock, int size);
|
||||
|
||||
/*
|
||||
* Set Socket TimeOut (opt = SO_SNDTIMEO/SO_RCVTIMEO)
|
||||
*/
|
||||
|
@ -3099,6 +3099,9 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac,
|
||||
|
||||
// Valid Socket produced
|
||||
if (tcpsocket > 0) {
|
||||
// Change socket MSS
|
||||
setSockMSS(tcpsocket, PSP_ADHOC_PTP_MSS);
|
||||
|
||||
// Change socket buffer size to be consistent on all platforms.
|
||||
setSockBufferSize(tcpsocket, SO_SNDBUF, bufsize*2); //PSP_ADHOC_PTP_MFS
|
||||
setSockBufferSize(tcpsocket, SO_RCVBUF, bufsize*10); //PSP_ADHOC_PTP_MFS*10
|
||||
@ -3269,6 +3272,9 @@ int AcceptPtpSocket(int ptpId, int newsocket, sockaddr_in& peeraddr, SceNetEther
|
||||
// Copy Socket Descriptor to Structure
|
||||
internal->data.ptp.id = newsocket;
|
||||
|
||||
// Change socket MSS
|
||||
setSockMSS(newsocket, PSP_ADHOC_PTP_MSS);
|
||||
|
||||
// Set Default Buffer Size or inherit the size?
|
||||
internal->buffer_size = socket->buffer_size;
|
||||
setSockBufferSize(newsocket, SO_SNDBUF, internal->buffer_size*2); //PSP_ADHOC_PTP_MSS
|
||||
@ -3641,6 +3647,9 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int
|
||||
|
||||
// Valid Socket produced
|
||||
if (tcpsocket > 0) {
|
||||
// Change socket MSS
|
||||
setSockMSS(tcpsocket, PSP_ADHOC_PTP_MSS);
|
||||
|
||||
// Change socket buffer size to be consistent on all platforms.
|
||||
setSockBufferSize(tcpsocket, SO_SNDBUF, bufsize*2); //PSP_ADHOC_PTP_MFS
|
||||
setSockBufferSize(tcpsocket, SO_RCVBUF, bufsize*10); //PSP_ADHOC_PTP_MFS*10
|
||||
|
Loading…
Reference in New Issue
Block a user