private void ExecuteCommand() { iteration++; try { node = (AsyncNode)GetNode(cluster); node.ValidateErrorCount(); eventArgs.RemoteEndPoint = node.address; conn = node.GetAsyncConnection(); if (conn == null) { node.IncrAsyncConnTotal(); conn = new AsyncConnection(node.address, node); eventArgs.SetBuffer(segment.buffer, segment.offset, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } else { ConnectionReady(); } ErrorCount = 0; } catch (AerospikeException.Connection aec) { ErrorCount++; ConnectionFailed(aec); } catch (AerospikeException.Backoff aeb) { ErrorCount++; Backoff(aeb); } catch (AerospikeException ae) { ErrorCount++; FailOnApplicationError(ae); } catch (SocketException se) { ErrorCount++; ConnectionFailed(GetAerospikeException(se.SocketErrorCode)); } catch (Exception e) { ErrorCount++; FailOnApplicationError(new AerospikeException(e)); } }
public AsyncConnector( AsyncCluster cluster, AsyncNode node, ConnectorListener listener, SocketAsyncEventArgs args, byte[] buffer ) { this.cluster = cluster; this.node = node; this.listener = listener; this.eventArgs = args; this.eventArgs.UserToken = this; this.dataBuffer = buffer; this.watch = Stopwatch.StartNew(); AsyncTimeoutQueue.Instance.Add(this, cluster.connectionTimeout); node.IncrAsyncConnTotal(); conn = new AsyncConnection(node.address, node); try { eventArgs.SetBuffer(dataBuffer, 0, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } catch (Exception) { node.CloseAsyncConnOnError(conn); throw; } }