MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / New

Method New

src/External/CascLib/src/common/Sockets.cpp:264–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264PCASC_SOCKET CASC_SOCKET::New(PADDRINFO remoteList, PADDRINFO remoteItem, const char * hostName, unsigned portNum, HANDLE sock)
265{
266 PCASC_SOCKET pSocket;
267 size_t length = strlen(hostName);
268
269 // Allocate enough bytes
270 pSocket = (PCASC_SOCKET)CASC_ALLOC<BYTE>(sizeof(CASC_SOCKET) + length);
271 if(pSocket != NULL)
272 {
273 // Fill the entire object with zero
274 memset(pSocket, 0, sizeof(CASC_SOCKET) + length);
275 pSocket->remoteList = remoteList;
276 pSocket->remoteItem = remoteItem;
277 pSocket->dwRefCount = 1;
278 pSocket->portNum = portNum;
279 pSocket->sock = sock;
280
281 // Init the remote host name
282 CascStrCopy((char *)pSocket->hostName, length + 1, hostName);
283
284 // Init the socket lock
285 CascInitLock(pSocket->Lock);
286 }
287
288 return pSocket;
289}
290
291PCASC_SOCKET CASC_SOCKET::Connect(const char * hostName, unsigned portNum)
292{

Callers 4

LoadCascStorageFunction · 0.45
CheckForDirectoryFunction · 0.45
CheckDataFilesDirectoryFunction · 0.45
CreateIndexFileNameFunction · 0.45

Calls 1

CascStrCopyFunction · 0.85

Tested by

no test coverage detected