def send_traffic_info(self, info_list): traffic_info_msg = create_msg("traffic_info", data=info_list) status = self._server_proxy.send(traffic_info_msg) if not status: logger.error("Failed to send message 'traffic_info'") return status
def send_last_file_events_request(self, last_event_id, checked_event_id, events_count_check, node_without_backup=False): """ Sends message 'last_file_events' @param last_event_id [int] Max server event id. @param checked_event_id [int] Max checked event id. @param events_count_check [int] Count of checked events. @param node_without_backup [bool] Is node in saving backups mode Server will send events with ids equal or greater than last_event_id if events_count_check is correct on server database. @return Operation successful flag [bool] """ # Send message via signalling server data = { 'last_event_id': str(last_event_id), 'checked_event_id': str(checked_event_id), 'events_count_check': str(events_count_check) } data['node_without_backup'] = "1" if node_without_backup else "0" status = self._server_proxy.send( create_msg('last_file_events', data=data)) if not status: logger.error("Failed to send message 'last_file_events'") return status
def send_share_downloaded(self, share_hash): """ Sends notification 'share_downloaded' @param share_hash [str] @return Operation successful flag [bool] """ # Send message via signalling server status = self._server_proxy.send( create_msg('share_downloaded', data={'share_hash': share_hash})) if not status: logger.error("Failed to send notification 'share_downloaded'") return status
def send_patches_info(self, patches_info): """ Sends pathes info @param pathes_info [dict] @return Operation successful flag [bool] """ # Send message via signalling server status = self._server_proxy.send( create_msg('patches_info', data=patches_info)) if not status: logger.error("Failed to send pathes info notification") return status
def send_node_status(self, node_status): """ Sends node status update @param node_status, currently - disk_usage, download_speed, upload_speed [dict] @return Operation successful flag [bool] """ # Send message via signalling server status = self._server_proxy.send( create_msg('node_status', data=node_status)) if not status: logger.error("Failed to send node status notification") return status
def send_upload_failed(self, upload_id): """ Sends notification on upload completion fail @param upload_id ID of upload [str] @return Operation successful flag [bool] """ # Send message via signalling server status = self._server_proxy.send( create_msg('upload_failed', data={'upload_id': upload_id})) if not status: logger.error( "Failed to notify signalling server on upload ID '%s' " "fail", upload_id) return status
def notify_sharing_disable(self, uuid): """ Sends info on sharing disabling to other nodes of the user. Removes sharing information stored locally @param uuid Unique shared file/folder ID [str] @return Operation successful flag [bool] """ # Send message via signalling server if not self._server_proxy.send( create_msg('sharing_disable', data=dict(uuid=uuid))): return False # Remove info stored locally self._storage.sharing_disable(uuid) return True
def send_sdp_message(self, node_id, conn_uuid, sdp_message): """ Sends SDP message to another node via signalling server @param node_id Other node ID [str] @param conn_uuid UUID of connection [str] @param sdp_message SDP message data [str] @return Operation successful flag [bool] """ return self._server_proxy.send( create_msg('sdp', node_id=node_id, data={ 'conn_uuid': conn_uuid, 'message': sdp_message }))