void LTcpClient::connectCallback(VMINT handle, VMINT event, void *userData) { LTcpClient *pThis = (LTcpClient*)userData; vm_log_info("connectCallback handle=%d event=%d userData=%d", handle, event, userData); switch(event) { case VM_TCP_EVT_CONNECTED: pThis->m_handle = SharedHandle(handle); LTask.post_signal(); break; case VM_TCP_EVT_CAN_WRITE: break; case VM_TCP_EVT_CAN_READ: break; case VM_TCP_EVT_PIPE_BROKEN: pThis->m_handle.invalidateHandle(); LTask.post_signal(); break; case VM_TCP_EVT_HOST_NOT_FOUND: pThis->m_handle.invalidateHandle(); LTask.post_signal(); break; case VM_TCP_EVT_PIPE_CLOSED: pThis->m_handle.invalidateHandle(); LTask.post_signal(); break; } return; }
FSDirectory::FSIndexInput::FSIndexInput(const char* path, int32_t __bufferSize): BufferedIndexInput(__bufferSize) { //Func - Constructor. // Opens the file named path //Pre - path != NULL //Post - if the file could not be opened an exception is thrown. CND_PRECONDITION(path != NULL, "path is NULL"); handle = _CLNEW SharedHandle(); strcpy(handle->path,path); //Open the file handle->fhandle = _open(path, O_BINARY | O_RDONLY | O_RANDOM, _S_IREAD ); //Check if a valid handle was retrieved if (handle->fhandle < 0){ int err = errno; if ( err == ENOENT ) _CLTHROWA(CL_ERR_IO, "File does not exist"); else if ( err == EACCES ) _CLTHROWA(CL_ERR_IO, "File Access denied"); else if ( err == EMFILE ) _CLTHROWA(CL_ERR_IO, "Too many open files"); } //Store the file length handle->_length = fileSize(handle->fhandle); handle->_fpos = 0; this->_pos = 0; }
void FOnlineAsyncTaskSteamWriteSharedFile::Finalize() { FOnlineAsyncTaskSteam::Finalize(); if (bWasSuccessful) { // If the task failed, we'll have no "handle" to associate with the done state FOnlineSharedCloudSteamPtr SharedCloud = StaticCastSharedPtr<FOnlineSharedCloudSteam>(Subsystem->GetSharedCloudInterface()); FSharedContentHandleSteam SharedHandle(CallbackResults.m_hFile); // Create the entry to hold the data FCloudFileSteam* SharedFile = SharedCloud->GetSharedCloudFile(SharedHandle); if (SharedFile) { SharedFile->Data = Contents; SharedFile->AsyncState = EOnlineAsyncTaskState::Done; } } // Done with this copy of the data regardless Contents.Empty(); }
void LTcpClient::stop() { // release reference to handle m_handle = SharedHandle(); }