Skip to content

Commit

Permalink
변수 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
nwar-Jeon committed Dec 3, 2019
1 parent 7ebe9e5 commit c0725a4
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import kr.hs.dsm.java.taxipot_backend.repository.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
Expand All @@ -14,13 +13,13 @@

public class SocketHandler extends TextWebSocketHandler {

UserRepository repository;
UserRepository userRepository;
SocketRepository socketRepo;

Logger logger = LoggerFactory.getLogger(SocketHandler.class);

public SocketHandler(UserRepository repository, SocketRepository socketRepo) {
this.repository = repository;
this.userRepository = repository;
this.socketRepo = socketRepo;
}

Expand Down Expand Up @@ -92,7 +91,7 @@ private String[] splitMessage(TextMessage message, String regex) {

private void disconnect(WebSocketSession session, int room_id, String userId) { //TODO DB에서 USER.ROOMID, SEATNUM 삭제 작업 해줘야함.
socketRepo.getSocketMap().get(room_id).onClose(session);
applyUserChange(removeSocketInfoOnUser(repository.findById(userId)));
applyUserChange(removeSocketInfoOnUser(userRepository.findById(userId)));
}

private User removeSocketInfoOnUser(Optional<User> userOptional) {
Expand All @@ -109,7 +108,7 @@ private void applyUserChange(User user) {
if(user==null) {
return;
}
repository.save(user);
userRepository.save(user);
}

}

0 comments on commit c0725a4

Please sign in to comment.