// File: luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::updateThread()
void FileSystem::updateThread(){
    myNode = membership.getMyNode();
    myself.ip_str = myNode.ip_str;
    myself.key = hashString( myself.ip_str );

    while(true){

        MemberUpdateMsg msg = membership.pullMsgFromFileSysQueue();
        
        if(msg.type == MSG_JOIN){
            // cout<<"recv join msg: "<<msg.node.ip_str<<endl;
            //if(msg.node.ip_str.compare(myNode.ip_str) != 0)
                detectJoin( msg.node );
            //else
                //myselfJoin( msg.node );
        }
        else if(msg.type == MSG_JOIN_FINISH){
            myJoinFinished( );
        }
        else if(msg.type == MSG_LEAVE || msg.type == MSG_FAIL ){
            // cout<<"recv leave msg: "<<msg.node.ip_str<<endl;
            if( msg.node.ip_str.compare(myNode.ip_str) != 0 )
                detectLeave( msg.node );
            else
                myselfLeave( msg.node );
        }
        //printVirtualRing();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq 0x208(%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0xb430
movq -0x118(%rbp), %rdi
addq $0x2c0, %rdi            # imm = 0x2C0
leaq -0x30(%rbp), %rsi
callq 0xf110
leaq -0x30(%rbp), %rdi
callq 0xb7f0
movq -0x118(%rbp), %rdi
movq %rdi, %rsi
addq $0x2c0, %rsi            # imm = 0x2C0
addq $0x298, %rdi            # imm = 0x298
callq 0x4050
movq -0x118(%rbp), %rsi
addq $0x298, %rsi            # imm = 0x298
leaq -0x50(%rbp), %rdi
callq 0x41e0
leaq -0x50(%rbp), %rdi
callq 0x10600
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x2b8(%rax)
leaq -0x50(%rbp), %rdi
callq 0x42a0
movq -0x118(%rbp), %rax
movq 0x208(%rax), %rsi
leaq -0x88(%rbp), %rdi
callq 0xb2a0
cmpl $0x6, -0x88(%rbp)
jne 0x10984
leaq -0x80(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0xb8f0
jmp 0x10924
movq -0x118(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x15780
jmp 0x10939
leaq -0xb0(%rbp), %rdi
callq 0xb7f0
jmp 0x10a90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x10aa1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xb7f0
jmp 0x10aa1
cmpl $0x8, -0x88(%rbp)
jne 0x109a0
movq -0x118(%rbp), %rdi
callq 0x14ee0
jmp 0x1099b
jmp 0x10a8e
cmpl $0x7, -0x88(%rbp)
je 0x109b6
cmpl $0x5, -0x88(%rbp)
jne 0x10a8c
movq -0x118(%rbp), %rsi
leaq -0x80(%rbp), %rdi
addq $0x2c0, %rsi            # imm = 0x2C0
callq 0x4040
movl %eax, -0x11c(%rbp)
jmp 0x109d5
movl -0x11c(%rbp), %eax
cmpl $0x0, %eax
je 0x10a35
leaq -0x80(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0xb8f0
jmp 0x109f2
movq -0x118(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x157f0
jmp 0x10a07
leaq -0xe8(%rbp), %rdi
callq 0xb7f0
jmp 0x10a8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xb7f0
jmp 0x10aa1
leaq -0x80(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0xb8f0
jmp 0x10a47
movq -0x118(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x16130
jmp 0x10a5c
leaq -0x110(%rbp), %rdi
callq 0xb7f0
jmp 0x10a8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x110(%rbp), %rdi
callq 0xb7f0
jmp 0x10aa1
jmp 0x10a8c
jmp 0x10a8e
jmp 0x10a90
leaq -0x88(%rbp), %rdi
callq 0xb930
jmp 0x108ef
leaq -0x88(%rbp), %rdi
callq 0xb930
movq -0xb8(%rbp), %rdi
callq 0x46a0
nopl (%rax)