Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321063

Summary: [tcf][agent] The script functionality of the C client doesn't work
Product: [Tools] TCF Reporter: Michael Sills-Lavoie <michael.sills.lavoie>
Component: CoreAssignee: Project Inbox <dsdp.tm.tcf-inbox>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, eugene
Version: unspecified   
Target Milestone: 0.4.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Script test example none

Description Michael Sills-Lavoie CLA 2010-07-27 15:36:56 EDT
Build Identifier: rev 1079

Since revision 900, it's impossible to use the script functionality with the C client.

The client report the channel as closed even if it's not : Reply error 131077: Channel closed.

This is due to the addition of an if statement in protocol.c at line 429 (last revision): 

if (c->peer_service_list == NULL) {
    post_event(send_command_failed, rh);
}

This statement checks if the remote agent has any services. Since the "hello" message is not received at the time of sending the command, the client report the connection as closed. Removing this check resolve the problem.

Removing the check is probably not the best option. Adding a sleep after a connect command in the client is not either but I am not sure how you want to solve this.

Reproducible: Always

Steps to Reproduce:
1. Start an agent with at least one service that you will use to send a command.
2. Create a script file with a connect statement followed by any command (see attachment for an example).
3. Start the client with the script you just created : client -S test
4. The client report that the channel is closed.
Comment 1 Michael Sills-Lavoie CLA 2010-07-27 15:37:53 EDT
Created attachment 175347 [details]
Script test example
Comment 2 Eugene Tarassov CLA 2010-07-28 13:54:56 EDT
"connect" command handler in cmdline.c calls cmd_done() when a channel socket is connected, which is too early. I have changed the code to call cmd_done() when the channel itself (not just the socket) is connected.
Comment 3 Doug Schaefer CLA 2011-05-17 10:50:52 EDT
Moving bugs to new home for IP log.
Comment 4 Martin Oberhuber CLA 2013-06-05 06:28:40 EDT
Bulk change: Marking all bugs from the TM era (until June 2011) target 0.3