Beispiel #1
0
func (testRunner *TestRunner) sendProcessKillMessage() {
	id := common.GetUniqueID()
	message := &gauge_messages.Message{MessageId: &id, MessageType: gauge_messages.Message_KillProcessRequest.Enum(),
		KillProcessRequest: &gauge_messages.KillProcessRequest{}}

	conn.WriteGaugeMessage(message, testRunner.Connection)
}
Beispiel #2
0
// SendProcessKillMessage sends a KillProcessRequest message through the connection.
func SendProcessKillMessage(connection net.Conn) {
	id := common.GetUniqueID()
	message := &gauge_messages.Message{MessageId: &id, MessageType: gauge_messages.Message_KillProcessRequest.Enum(),
		KillProcessRequest: &gauge_messages.KillProcessRequest{}}

	WriteGaugeMessage(message, connection)
}
Beispiel #3
0
func WriteGaugeMessage(message *gauge_messages.Message, conn net.Conn) error {
	messageId := common.GetUniqueID()
	message.MessageId = &messageId

	data, err := proto.Marshal(message)
	if err != nil {
		return err
	}
	return Write(conn, data)
}
Beispiel #4
0
func (p *plugin) sendMessage(message *gauge_messages.Message) error {
	messageID := common.GetUniqueID()
	message.MessageId = &messageID
	messageBytes, err := proto.Marshal(message)
	if err != nil {
		return err
	}
	err = conn.Write(p.connection, messageBytes)
	if err != nil {
		return fmt.Errorf("[Warning] Failed to send message to plugin: %s  %s", p.descriptor.ID, err.Error())
	}
	return nil
}
Beispiel #5
0
func GetResponseForGaugeMessage(message *gauge_messages.Message, conn net.Conn) (*gauge_messages.Message, error) {
	messageId := common.GetUniqueID()
	message.MessageId = &messageId

	data, err := proto.Marshal(message)
	if err != nil {
		return nil, err
	}
	responseBytes, err := WriteDataAndGetResponse(conn, data)
	if err != nil {
		return nil, err
	}
	responseMessage := &gauge_messages.Message{}
	if err := proto.Unmarshal(responseBytes, responseMessage); err != nil {
		return nil, err
	}

	if err := checkUnsupportedResponseMessage(responseMessage); err != nil {
		return responseMessage, err
	}
	return responseMessage, err
}
Beispiel #6
0
func (handler *gaugeAPIMessageHandler) getErrorMessage(err error) *gauge_messages.APIMessage {
	id := common.GetUniqueID()
	errorResponse := &gauge_messages.ErrorResponse{Error: proto.String(err.Error())}
	return &gauge_messages.APIMessage{MessageType: gauge_messages.APIMessage_ErrorResponse.Enum(), MessageId: &id, Error: errorResponse}
}
Beispiel #7
0
func uniqueFileName() string {
	return fmt.Sprintf("%d", common.GetUniqueID())
}