Author: ab Date: 2006-06-20 14:18:51 +0000 (Tue, 20 Jun 2006) New Revision: 16417
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16417 Log: Fix ping/pong responses as wrong destination was specified in the message. Patch from Aleksey Fedoseev. Modified: branches/tmp/vl-messaging/source/lib/messages_socket.c branches/tmp/vl-messaging/source/lib/messages_stream.c Changeset: Modified: branches/tmp/vl-messaging/source/lib/messages_socket.c =================================================================== --- branches/tmp/vl-messaging/source/lib/messages_socket.c 2006-06-20 12:30:50 UTC (rev 16416) +++ branches/tmp/vl-messaging/source/lib/messages_socket.c 2006-06-20 14:18:51 UTC (rev 16417) @@ -191,8 +191,9 @@ unsigned int timeout) { if ((enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_STREAM) { - return message_send_pid_stream(pid, msg_type, buf, len, - duplicates_allowed, timeout); + return message_send_pid_stream(procid_self(), pid, + msg_type, buf, len, + duplicates_allowed, timeout); } else { struct message_list *li, *tmp; uint8_t* buffer; Modified: branches/tmp/vl-messaging/source/lib/messages_stream.c =================================================================== --- branches/tmp/vl-messaging/source/lib/messages_stream.c 2006-06-20 12:30:50 UTC (rev 16416) +++ branches/tmp/vl-messaging/source/lib/messages_stream.c 2006-06-20 14:18:51 UTC (rev 16417) @@ -291,6 +291,7 @@ ****************************************************************************/ static BOOL message_send_pid_stream_internal(struct messaging_client *client, + struct process_id from, int msg_type, const void *buf, size_t len, BOOL duplicates_allowed, @@ -315,7 +316,7 @@ li->msg->len = len + sizeof(struct message_rec); li->msg->msg_version = MESSAGE_VERSION; li->msg->msg_type = msg_type; - li->msg->src = procid_self(); + li->msg->src = from; li->msg->dest = client->pid; if (len > 0) { memcpy(buffer + sizeof(struct message_rec), buf, len); @@ -432,7 +433,8 @@ if(mtype == MESSAGING_TYPE_STREAM) { /* Send HELLO message to the new client (local clients only) */ - message_send_pid_stream_internal(result, MSG_HELLO, NULL, 0, False, 0); + message_send_pid_stream_internal(result, procid_self(), + MSG_HELLO, NULL, 0, False, 0); } DEBUG(10, ("Connecting to client %s\n", @@ -642,26 +644,27 @@ Send a message to a particular pid. ****************************************************************************/ -BOOL message_send_pid_stream(struct process_id pid, int msg_type, +BOOL message_send_pid_stream(struct process_id from, struct process_id to, + int msg_type, const void *buf, size_t len, BOOL duplicates_allowed, unsigned int timeout) { struct messaging_client *client; - client = find_client(&pid); + client = find_client(&to); if(client == NULL) { /* Try to connect */ - client = connect_client(&pid); + client = connect_client(&to); if(client == NULL) { DEBUG(5, ("Can't connect to client %s\n", - procid_str_static(&pid))); + procid_str_static(&to))); return False; } } - return message_send_pid_stream_internal(client, msg_type, + return message_send_pid_stream_internal(client, from, msg_type, buf, len, duplicates_allowed, timeout); } @@ -901,7 +904,7 @@ SAFE_FREE(sname); /* one more copy - from main context to client's context */ - message_send_pid_stream(msg->dest, msg->msg_type, + message_send_pid_stream(msg->src, msg->dest, msg->msg_type, (uint8_t*)msg + sizeof(struct message_rec), msg->len - sizeof(struct message_rec), False,