Skip to content

Fixes #1 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions sourcebox-server/server_communication_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _command_loop(self, thread_name, connection):

# Parse the command
def _parse_command(self, cmd, data):
self.log.debug('Recieved Command from the client ' + self.computer_name + ': ' + data[0])
self.log.debug('Received Command from the client ' + self.computer_name + ': ' + data[0])
if cmd == self.COMMAND_GETCREATEFILE:
self._get_create_file(data)
elif cmd == self.COMMAND_SENDLOCKFILE:
Expand All @@ -99,7 +99,7 @@ def _parse_command(self, cmd, data):
elif cmd == 'OK\n':
self.ok.set()
else:
self.log.warning('recieved unknown command: ' + cmd)
self.log.warning('received unknown command: ' + cmd)

# closes the connection to the client
def _close_connection(self):
Expand All @@ -118,12 +118,12 @@ def send_create_file(self, size, path, content):

self.connection.send(mess)

# Wait for the recieve thread to send us a ok Event
# Wait for the receive thread to send us a ok Event
status = self.ok.wait(8.0)
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client ' + self.computer_name)
'Did not receive a response from the client ' + self.computer_name)
if not size == 0:
self.connection.send(content)
self.log.debug("send content to client")
Expand All @@ -132,7 +132,7 @@ def send_create_file(self, size, path, content):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client ' + self.computer_name)
'Did not receive a response from the client ' + self.computer_name)

# self.log.debug('Hello. Creation worked. The client said he is ok :)')
except IOError, err:
Expand All @@ -149,7 +149,7 @@ def send_close(self):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the the client ' + self.computer_name)
'Did not receive a response from the the client ' + self.computer_name)
self.connection.close()

# server notifies the client about delete file (initiated by another user)
Expand All @@ -165,7 +165,7 @@ def send_delete_file(self, path):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the the client ' + self.computer_name)
'Did not receive a response from the the client ' + self.computer_name)

# self.log.debug('Hello. Delete worked. The client said he is ok :)')

Expand All @@ -182,7 +182,7 @@ def send_modify_file(self, size, path, content):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client ' + self.computer_name)
'Did not receive a response from the client ' + self.computer_name)
if not size == 0:
self.connection.send(content)

Expand All @@ -191,7 +191,7 @@ def send_modify_file(self, size, path, content):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client ' + self.computer_name)
'Did not receive a response from the client ' + self.computer_name)

# self.log.debug('Hello. Modifying worked. The client said he is ok :)')

Expand All @@ -209,7 +209,7 @@ def send_lock_file(self, path):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client.' + self.computer_name)
'Did not receive a response from the client.' + self.computer_name)

# self.log.debug('Hello. Locking worked. The client said he is ok :)')
except IOError, err:
Expand All @@ -223,12 +223,12 @@ def send_unlock_file(self, path):
try:
self.connection.send(mess)

# Wait for the recieve thread to send us a ok Event
# Wait for the receive thread to send us a ok Event
status = self.ok.wait(8.0)
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client ' + self.computer_name)
'Did not receive a response from the client ' + self.computer_name)

## self.log.debug(
# 'Hello. Unlocking worked. The client said he is ok :)')
Expand All @@ -244,12 +244,12 @@ def send_create_dir(self, path):

self.connection.send(mess)

# Wait for the recieve thread to send us a ok Event
# Wait for the receive thread to send us a ok Event
status = self.ok.wait(8.0)
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client.' + self.computer_name)
'Did not receive a response from the client.' + self.computer_name)
except IOError, err:
self.log.error(str(err))

Expand All @@ -268,7 +268,7 @@ def send_delete_dir(self, path):
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client.' + self.computer_name)
'Did not receive a response from the client.' + self.computer_name)
except IOError, err:
self.log.error(str(err))

Expand All @@ -280,12 +280,12 @@ def send_move(self, old_file_path, new_file_path):

self.connection.send(mess)

# Wait for the recieve thread to send us a ok Event
# Wait for the receive thread to send us a ok Event
status = self.ok.wait(8.0)
self.ok.clear()
if not status:
raise IOError(
'Did not recieve a response from the client.' + self.computer_name)
'Did not receive a response from the client.' + self.computer_name)
except IOError, err:
self.log.error(str(err))

Expand Down Expand Up @@ -377,9 +377,9 @@ def _get_delete_dir(self, data):
# @returns a dictionary like { 'command' : command, 'file_path' : file_path} or None (if error)
def _recieve_command(self, data):
command = data[0]
self.log.debug('Recieved ' + str(data))
self.log.debug('Received ' + str(data))
file_path = url2pathname(data[1])
self.log.debug('Recieve command ' + str(file_path))
self.log.debug('Receive command ' + str(file_path))

if len(file_path) == 0:
self.connection.send('ERROR\n')
Expand Down