Merge pull request #5007 from jefrsilva/ptpopenfix

Fix for not updating local port information after bind in PtpOpen
This commit is contained in:
Henrik Rydgård 2014-01-04 07:57:16 -08:00
commit 7e7d888876

View File

@ -1174,6 +1174,12 @@ int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dp
// Bound Socket to local Port
if (bind(tcpsocket, (sockaddr *)&addr, sizeof(addr)) == 0) {
// Update sport with the port assigned by bind
socklen_t len = sizeof(addr);
if (getsockname(tcpsocket, (sockaddr *)&addr, &len) == 0) {
sport = ntohs(addr.sin_port);
}
// Allocate Memory
SceNetAdhocPtpStat * internal = (SceNetAdhocPtpStat *)malloc(sizeof(SceNetAdhocPtpStat));