internal override async Task <bool> Stop(ulong timeout) { WSLOG("Stop"); _mustStop = true; if (_reconnectionTimer != null) { _reconnectionTimer.Cancel(); } foreach (Queue <WSRequest> queue in _workingRequests) { while (queue.Count > 0) { WSRequest wsRequest = queue.Peek(); await wsRequest.getResponseBytes(); if (queue.Contains(wsRequest)) { queue.Dequeue(); } } } _webSock.Close(1000, ""); //_outDataWriter = null; WSLOG("Stop end"); return(false); }
internal override async Task <byte[]> hubRequestSync(string req_first_line, byte[] req_head_and_body, uint mstimeout) { WSRequest wsRequest = await sendRequest(req_first_line, req_head_and_body, HUB_TCP_CHANNEL, false, null, null); byte[] full_result = await wsRequest.getResponseBytes(); byte[] immVerifyHttPheader = imm_verifyHTTPheader(full_result); return(immVerifyHttPheader); }
internal override async Task <byte[]> devRequestSync(YDevice device, string req_first_line, byte[] req_head_and_body, uint mstimeout, YGenericHub.RequestProgress progress, object context) { if (mstimeout == 0) { // simulate a wait indefinitely mstimeout = 86400000; //24h } WSRequest wsRequest = await sendRequest(req_first_line, req_head_and_body, DEVICE_TCP_CHANNEL, false, progress, context); byte[] full_result = await wsRequest.getResponseBytes(); return(imm_verifyHTTPheader(full_result)); }