1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 02:51:27 +00:00

Completely kill pnUtAddr and NetAddress.

This commit is contained in:
Darryl Pogue
2012-03-26 21:49:10 -07:00
parent 3ea3473d13
commit 3ba721711e
17 changed files with 56 additions and 117 deletions

View File

@ -191,7 +191,7 @@ void NtWaitForShutdown ();
void NtSleep (unsigned sleepMs);
void NtSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
@ -228,11 +228,11 @@ void NtSocketSetBacklogAlloc (
unsigned bufferSize
);
unsigned NtSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void NtSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void NtSocketEnableNagling (

View File

@ -77,7 +77,7 @@ static const unsigned kMinBacklogBytes = 4 * 1024;
struct NtListener {
LINK(NtListener) nextPort;
SOCKET hSocket;
NetAddress addr;
plNetAddress addr;
FAsyncNotifySocketProc notifyProc;
int listenCount;
@ -91,7 +91,7 @@ struct NtOpConnAttempt : Operation {
AsyncCancelId cancelId;
bool canceled;
unsigned localPort;
NetAddress remoteAddr;
plNetAddress remoteAddr;
FAsyncNotifySocketProc notifyProc;
void * param;
SOCKET hSocket;
@ -113,7 +113,7 @@ struct NtOpSocketRead : Operation {
struct NtSock : NtObject {
LINK(NtSock) link;
NetAddress addr;
plNetAddress addr;
unsigned closeTimeMs;
unsigned connType;
FAsyncNotifySocketProc notifyProc;
@ -171,7 +171,7 @@ NtSock::~NtSock () {
//===========================================================================
// must be called inside s_listenCrit
static bool ListenPortIncrement (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc,
int count
) {
@ -192,12 +192,11 @@ static bool ListenPortIncrement (
//===========================================================================
static void SocketGetAddresses (
NtSock * sock,
NetAddress * localAddr,
NetAddress * remoteAddr
plNetAddress* localAddr,
plNetAddress* remoteAddr
) {
// NetAddress may be bigger than sockaddr_in so start by zeroing the whole thing
memset(localAddr, 0, sizeof(*localAddr));
memset(remoteAddr, 0, sizeof(*remoteAddr));
localAddr->Clear();
remoteAddr->Clear();
// don't have to enter critsect or validate socket before referencing it
// because this routine is called before the user has a chance to close it
@ -470,7 +469,7 @@ static bool SocketInitConnect (
//===========================================================================
static void SocketInitListen (
NtSock * const sock,
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
for (;;) {
@ -509,7 +508,7 @@ static void SocketInitListen (
}
//===========================================================================
static SOCKET ListenSocket (NetAddress * listenAddr) {
static SOCKET ListenSocket(plNetAddress* listenAddr) {
// create a new socket to listen
SOCKET s;
if (INVALID_SOCKET == (s = socket(AF_INET, SOCK_STREAM, 0))) {
@ -612,7 +611,7 @@ static void ListenPrepareListeners (fd_set * readfds) {
}
//===========================================================================
static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) {
static SOCKET ConnectSocket (unsigned localPort, const plNetAddress& addr) {
SOCKET s;
if (INVALID_SOCKET == (s = socket(AF_INET, SOCK_STREAM, 0))) {
LogMsg(kLogError, "socket create failed");
@ -1126,12 +1125,12 @@ bool INtSocketOpCompleteQueuedSocketWrite (
//===========================================================================
unsigned NtSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
s_listenCrit.Enter();
StartListenThread();
NetAddress addr = listenAddr;
plNetAddress addr = listenAddr;
for (;;) {
// if the port is already open then just increment the reference count
if (ListenPortIncrement(addr, notifyProc, 1))
@ -1160,7 +1159,7 @@ unsigned NtSocketStartListening (
//===========================================================================
void NtSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
s_listenCrit.Enter();
@ -1171,7 +1170,7 @@ void NtSocketStopListening (
//===========================================================================
void NtSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,