agent/acs/handler/attach_eni_handler.go
func (handler *attachENIHandler) addENIAttachmentToState(message *ecsacs.AttachTaskNetworkInterfacesMessage, receivedAt time.Time) error {
	attachmentARN := aws.StringValue(message.ElasticNetworkInterfaces[0].AttachmentArn)
	mac := aws.StringValue(message.ElasticNetworkInterfaces[0].MacAddress)
	taskARN := aws.StringValue(message.TaskArn)
	eniAttachment := &apieni.ENIAttachment{
		TaskARN:          taskARN,
		AttachmentARN:    attachmentARN,
		AttachStatusSent: false,
		MACAddress:       mac,
		// Stop tracking the eni attachment after timeout
		ExpiresAt: receivedAt.Add(time.Duration(aws.Int64Value(message.WaitTimeoutMs)) * time.Millisecond),
	}
	eniAckTimeoutHandler := ackTimeoutHandler{mac: mac, state: handler.state}
	if err := eniAttachment.StartTimer(eniAckTimeoutHandler.handle); err != nil {
		return err
	}
	seelog.Infof("Adding eni info for task '%s' to state, attachment=%s mac=%s",
		taskARN, attachmentARN, mac)
	handler.state.AddENIAttachment(eniAttachment)
	return nil
}
func (handler *attachENIHandler) addENIAttachmentToState(message *ecsacs.AttachTaskNetworkInterfacesMessage, receivedAt time.Time) error {
	attachmentARN := aws.StringValue(message.ElasticNetworkInterfaces[0].AttachmentArn)
	mac := aws.StringValue(message.ElasticNetworkInterfaces[0].MacAddress)
	taskARN := aws.StringValue(message.TaskArn)
	eniAttachment := &apieni.ENIAttachment{
		TaskARN:          taskARN,
		AttachmentARN:    attachmentARN,
		AttachStatusSent: false,
		MACAddress:       mac,
		// Stop tracking the eni attachment after timeout
		ExpiresAt: receivedAt.Add(time.Duration(aws.Int64Value(message.WaitTimeoutMs)) * time.Millisecond),
	}
	eniAckTimeoutHandler := ackTimeoutHandler{mac: mac, state: handler.state}
	if err := eniAttachment.StartTimer(eniAckTimeoutHandler.handle); err != nil {
		return err
	}
	seelog.Infof("Adding eni info for task '%s' to state, attachment=%s mac=%s",
		taskARN, attachmentARN, mac)
	handler.state.AddENIAttachment(eniAttachment)
	return nil
}
// addENIAttachmentToState adds the eni info to the state