Commit 716885a7 authored by opelhoward's avatar opelhoward
Browse files

Merge branch 'master' of...

Merge branch 'master' of http://gitlab.informatika.org/timothy.pratama/IF3230-Tugas-Besar-Sister-2015
parents 66a8d0dd 027c2d3d
......@@ -330,16 +330,23 @@ class ConnectionHandler:
Market.accept(offer_token)
# ini bagian yafi
# call accept
(socket,host,port) = (Socket.socket(), offer.ip, offer.port)
data = json.dumps({'status': 'ok'})
else:
data = json.dumps({'status': 'fail', 'description': 'offer is not available'})
try:
self._socketio.write_to_socket(data.encode('ascii'))
socket.settimeout(SocketIO.SERVER_CONNECTION_TIMEOUT)
try :
socket.connect((host,port))
except Exception as msg:
print(msg)
socketio = SocketIO(socket)
socketio.write_to_socket(json.dumps({'method':'accept','offer_token':offer.token}).encode('ascii'))
target_data = socketio.read_from_socket()
self._socketio.write_to_socket(target_data)
else:
data = json.dumps({'status': 'fail', 'description': 'offer is not available'})
# invoke map
def handle_fetchitem(self,token,offer_token):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment