-/* see if there is a process for the same mac */
-/* if the times don't match mac has been rebooted */
-void server_child_kill_one_by_id(server_child *children, const int forkid, const pid_t pid,
- const uid_t uid,
- const u_int32_t idlen, char *id, u_int32_t boottime)
-{
- server_child_fork *fork;
- struct server_child_data *child, *tmp;
- int i;
-
- fork = (server_child_fork *) children->fork + forkid;
- for (i = 0; i < CHILD_HASHSIZE; i++) {
- child = fork->table[i];
- while (child) {
- tmp = child->next;
- if ( child->pid != pid) {
- if ( child->idlen == idlen && !memcmp(child->clientid, id, idlen)) {
- if ( child->time != boottime ) {
- if (uid == child->uid) {
- if (kill_child(child)) {
- LOG(log_info, logtype_default, "Disconnecting old session %d, client rebooted.", child->pid);
- }
- }
- else {
- LOG(log_info, logtype_default, "Disconnecting old session not the same uid, bailout!");
- }
- }
- else if (child->killed) {
- /* there's case where a Mac close a connection and restart a new one before
- * the first is 'waited' by the master afpd process
- */
- LOG(log_info, logtype_default,
- "WARNING: connection (%d) killed but still there.", child->pid);
- }
- else {
- LOG(log_info, logtype_default,
- "WARNING: 2 connections (%d, %d), boottime identical, don't know if one needs to be disconnected.",
- child->pid, pid);
- }
-
- }
- }
- else
- {
- child->time = boottime;
- /* free old token if any */
- if (child->clientid) {
- free(child->clientid);
- }
- child->uid = uid;
- child->valid = 1;
- child->idlen = idlen;
- child->clientid = id;
- LOG(log_debug, logtype_default, "Setting clientid (len %d) for %d, boottime %X", idlen, child->pid, boottime);
- }
- child = tmp;
+ LOG(log_note, logtype_default, "Reconnect: transfering session to child[%u]", pid);
+
+ if (writet(child->afpch_ipc_fd, &DSI_requestID, 2, 0, 2) != 2) {
+ LOG(log_error, logtype_default, "Reconnect: error sending DSI id to child[%u]", pid);
+ EC_STATUS(-1);
+ goto EC_CLEANUP;