summaryrefslogtreecommitdiff
path: root/source4/wrepl_server/wrepl_in_call.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@redhat.com>2010-01-20 14:21:47 +0100
committerStefan Metzmacher <metze@samba.org>2010-03-03 09:22:37 +0100
commit3f946240fa892f79c83f9c00f1b16ea73c2ad237 (patch)
tree754ac26b72dd50d9546dcc07ead9c0432be87c7a /source4/wrepl_server/wrepl_in_call.c
parent27ae935a8df409ce7557bd369250fa450120fdfe (diff)
downloadsamba-3f946240fa892f79c83f9c00f1b16ea73c2ad237.tar.gz
samba-3f946240fa892f79c83f9c00f1b16ea73c2ad237.tar.bz2
samba-3f946240fa892f79c83f9c00f1b16ea73c2ad237.zip
s4-winrepl: Migrated the wins replication server to tsocket.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/wrepl_server/wrepl_in_call.c')
-rw-r--r--source4/wrepl_server/wrepl_in_call.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/source4/wrepl_server/wrepl_in_call.c b/source4/wrepl_server/wrepl_in_call.c
index fd09bbaf40..6737d6f5c8 100644
--- a/source4/wrepl_server/wrepl_in_call.c
+++ b/source4/wrepl_server/wrepl_in_call.c
@@ -31,6 +31,7 @@
#include "lib/ldb/include/ldb_errors.h"
#include "system/time.h"
#include "lib/util/tsort.h"
+#include "lib/stream/packet.h" /* FIXME */
static NTSTATUS wreplsrv_in_start_association(struct wreplsrv_in_call *call)
{
@@ -341,23 +342,31 @@ static NTSTATUS wreplsrv_in_update(struct wreplsrv_in_call *call)
struct wreplsrv_out_connection *wrepl_out;
struct wrepl_table *update_in = &call->req_packet.message.replication.info.table;
struct wreplsrv_in_update_state *update_state;
- uint16_t fde_flags;
+ struct packet_context *packet;
DEBUG(2,("WREPL_REPL_UPDATE: partner[%s] initiator[%s] num_owners[%u]\n",
call->wreplconn->partner->address,
update_in->initiator, update_in->partner_count));
- /*
- * we need to flip the connection into a client connection
+ update_state = talloc(wrepl_in, struct wreplsrv_in_update_state);
+ NT_STATUS_HAVE_NO_MEMORY(update_state);
+
+ /*
+ * We need to flip the connection into a client connection
* and do a WREPL_REPL_SEND_REQUEST's on the that connection
- * and then stop this connection
+ * and then stop this connection.
*/
- fde_flags = event_get_fd_flags(wrepl_in->conn->event.fde);
- talloc_free(wrepl_in->conn->event.fde);
- wrepl_in->conn->event.fde = NULL;
+ packet = packet_init(wrepl_in);
+ if (packet == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
- update_state = talloc(wrepl_in, struct wreplsrv_in_update_state);
- NT_STATUS_HAVE_NO_MEMORY(update_state);
+ /*
+ * TODO We can free the tstream here as we don't use it in the client
+ * yet.
+ */
+ TALLOC_FREE(wrepl_in->send_queue);
+ TALLOC_FREE(wrepl_in->tstream);
wrepl_out = talloc(update_state, struct wreplsrv_out_connection);
NT_STATUS_HAVE_NO_MEMORY(wrepl_out);
@@ -368,11 +377,9 @@ static NTSTATUS wreplsrv_in_update(struct wreplsrv_in_call *call)
wrepl_out->sock = wrepl_socket_merge(wrepl_out,
wrepl_in->conn->event.ctx,
wrepl_in->conn->socket,
- wrepl_in->packet);
+ packet);
NT_STATUS_HAVE_NO_MEMORY(wrepl_out->sock);
- event_set_fd_flags(wrepl_out->sock->event.fde, fde_flags);
-
update_state->wrepl_in = wrepl_in;
update_state->wrepl_out = wrepl_out;
update_state->cycle_io.in.partner = wrepl_out->partner;